Always send volume_id when booting with legacy bdm
Commit 5153dcda807c554769081626c10c43d16adea671 removed bdm v2-only request parameters to pass nova api v2.1 schema validation, but also removed the ability to boot with legacy bdm specifying volume_id only. This adds volume_id back to the request for legacy bdm when no other parameters are specified. Closes-Bug: #1501435 Change-Id: Ie8c56c28492793990ef7ed6dc54768cef9e28a98
This commit is contained in:
parent
3350a5713d
commit
abd0630bad
novaclient
@ -292,7 +292,9 @@ class BootingManagerWithFind(ManagerWithFind):
|
||||
mapping_parts = mapping.split(':')
|
||||
source_id = mapping_parts[0]
|
||||
|
||||
if len(mapping_parts) > 1:
|
||||
if len(mapping_parts) == 1:
|
||||
bdm_dict['volume_id'] = source_id
|
||||
elif len(mapping_parts) > 1:
|
||||
source_type = mapping_parts[1]
|
||||
if source_type.startswith('snap'):
|
||||
bdm_dict['snapshot_id'] = source_id
|
||||
|
@ -22,7 +22,7 @@ class TestServersBootNovaClient(base.ClientTestBase):
|
||||
|
||||
COMPUTE_API_VERSION = "2.1"
|
||||
|
||||
def test_boot_server_with_legacy_bdm(self):
|
||||
def _boot_server_with_legacy_bdm(self, bdm_params=()):
|
||||
volume_size = 1
|
||||
volume_name = str(uuid.uuid4())
|
||||
volume = self.client.volumes.create(size=volume_size,
|
||||
@ -30,17 +30,32 @@ class TestServersBootNovaClient(base.ClientTestBase):
|
||||
imageRef=self.image.id)
|
||||
self.wait_for_volume_status(volume, "available")
|
||||
|
||||
bdm_params = ':'.join(bdm_params)
|
||||
if bdm_params:
|
||||
bdm_params = ''.join((':', bdm_params))
|
||||
|
||||
server_info = self.nova("boot", params=(
|
||||
"%(name)s --flavor %(flavor)s --poll "
|
||||
"--block-device-mapping vda=%(volume_id)s:::1" % {
|
||||
"--block-device-mapping vda=%(volume_id)s%(bdm_params)s" % {
|
||||
"name": str(uuid.uuid4()), "flavor":
|
||||
self.flavor.id,
|
||||
"volume_id": volume.id}))
|
||||
"volume_id": volume.id,
|
||||
"bdm_params": bdm_params}))
|
||||
server_id = self._get_value_from_the_table(server_info, "id")
|
||||
|
||||
self.client.servers.delete(server_id)
|
||||
self.wait_for_resource_delete(server_id, self.client.servers)
|
||||
|
||||
def test_boot_server_with_legacy_bdm(self):
|
||||
# bdm v1 format
|
||||
# <id>:<type>:<size(GB)>:<delete-on-terminate>
|
||||
# params = (type, size, delete-on-terminate)
|
||||
params = ('', '', '1')
|
||||
self._boot_server_with_legacy_bdm(bdm_params=params)
|
||||
|
||||
def test_boot_server_with_legacy_bdm_volume_id_only(self):
|
||||
self._boot_server_with_legacy_bdm()
|
||||
|
||||
|
||||
class TestServersListNovaClient(base.ClientTestBase):
|
||||
"""Servers list functional tests.
|
||||
|
Loading…
x
Reference in New Issue
Block a user