V2:cinder create --image option doesn't work
In create volume help, --image optional parameter is allowed to be passed to create volume, but even after passing valid image ID or NAME, volume is created without image. Assigned image parameter to the image_ref to fix this issue. Closes-Bug: 1447589 Change-Id: I21b8a51451a2caf230ca04103b2d573d1aa966b4
This commit is contained in:
@@ -322,6 +322,15 @@ class ShellTest(utils.TestCase):
|
||||
self.assert_called_anytime('POST', '/volumes', partial_body=expected)
|
||||
self.assert_called('GET', '/volumes/1234')
|
||||
|
||||
def test_create_volume_from_image(self):
|
||||
expected = {'volume': {'status': 'creating',
|
||||
'size': 1,
|
||||
'imageRef': '1234',
|
||||
'attach_status': 'detached'}}
|
||||
self.run_command('create --image=1234 1')
|
||||
self.assert_called_anytime('POST', '/volumes', partial_body=expected)
|
||||
self.assert_called('GET', '/volumes/1234')
|
||||
|
||||
def test_create_size_required_if_not_snapshot_or_clone(self):
|
||||
self.assertRaises(SystemExit, self.run_command, 'create')
|
||||
|
||||
|
@@ -378,7 +378,7 @@ def do_create(cs, args):
|
||||
# NOTE(N.S.): end of taken piece
|
||||
|
||||
# Keep backward compatibility with image_id, favoring explicit ID
|
||||
image_ref = args.image_id or args.image_ref
|
||||
image_ref = args.image_id or args.image or args.image_ref
|
||||
|
||||
volume = cs.volumes.create(args.size,
|
||||
args.consisgroup_id,
|
||||
|
Reference in New Issue
Block a user