summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-05-23 14:38:16 +0000
committerGerrit Code Review <review@openstack.org>2019-05-23 14:38:16 +0000
commitbdc49fb62129190662603a22d9fd10a2beff7e5d (patch)
tree24f695d880520352f1116623f73912348e77953c
parentbdbd0df064b57c07fa6f54fbd1c2fdbce154d4c0 (diff)
parent7b9d3000893aefa9c5efc77b50dc0fec5cab29be (diff)
downloadpython-novaclient-bdc49fb62129190662603a22d9fd10a2beff7e5d.tar.gz
Merge "Set the lower limit of api_version for volume_type"
-rw-r--r--novaclient/tests/unit/v2/test_shell.py28
-rw-r--r--novaclient/v2/shell.py2
2 files changed, 29 insertions, 1 deletions
diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py
index 4f2ee258..354475dc 100644
--- a/novaclient/tests/unit/v2/test_shell.py
+++ b/novaclient/tests/unit/v2/test_shell.py
@@ -624,6 +624,34 @@ class ShellTest(utils.TestCase):
'size=1,format=ext4,type=disk,shutdown=foobar '
'some-server' % FAKE_UUID_1))
+ def test_boot_from_volume_with_volume_type_latest_microversion(self):
+ self.run_command(
+ 'boot --flavor 1 --block-device id=%s,source=image,dest=volume,'
+ 'size=1,bootindex=0,shutdown=remove,tag=foo,volume_type=lvm '
+ 'bfv-server' % FAKE_UUID_1, api_version='2.latest')
+ self.assert_called_anytime(
+ 'POST', '/servers',
+ {'server': {
+ 'flavorRef': '1',
+ 'name': 'bfv-server',
+ 'block_device_mapping_v2': [
+ {
+ 'uuid': FAKE_UUID_1,
+ 'source_type': 'image',
+ 'destination_type': 'volume',
+ 'volume_size': '1',
+ 'delete_on_termination': True,
+ 'tag': 'foo',
+ 'boot_index': '0',
+ 'volume_type': 'lvm'
+ },
+ ],
+ 'networks': 'auto',
+ 'imageRef': '',
+ 'min_count': 1,
+ 'max_count': 1,
+ }})
+
def test_boot_from_volume_with_volume_type_old_microversion(self):
ex = self.assertRaises(
exceptions.CommandError, self.run_command,
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py
index 88ebf2d7..6653aa2f 100644
--- a/novaclient/v2/shell.py
+++ b/novaclient/v2/shell.py
@@ -145,7 +145,7 @@ def _parse_block_device_mapping_v2(cs, args, image):
'delete_on_termination': False}
bdm.append(bdm_dict)
- supports_volume_type = cs.api_version == api_versions.APIVersion('2.67')
+ supports_volume_type = cs.api_version >= api_versions.APIVersion('2.67')
for device_spec in args.block_device:
spec_dict = _parse_device_spec(device_spec)