diff --git a/nova/tests/fixtures.py b/nova/tests/fixtures.py index 6df93db4c..ee3e8885c 100644 --- a/nova/tests/fixtures.py +++ b/nova/tests/fixtures.py @@ -1301,6 +1301,10 @@ class CinderFixture(fixtures.Fixture): SWAP_ERR_OLD_VOL = '828419fa-3efb-4533-b458-4267ca5fe9b1' SWAP_ERR_NEW_VOL = '9c6d9c2d-7a8f-4c80-938d-3bf062b8d489' + # This represents a bootable image-backed volume to test + # boot-from-volume scenarios. + IMAGE_BACKED_VOL = '6ca404f3-d844-4169-bb96-bc792f37de98' + def __init__(self, test): super(CinderFixture, self).__init__() self.test = test @@ -1378,6 +1382,17 @@ class CinderFixture(fixtures.Fixture): [volume['id'] in attachments for attachments in self.attachments.values()]) volume['status'] = 'attached' if has_attachment else 'detached' + + # Check for our special image-backed volume. + if volume_id == self.IMAGE_BACKED_VOL: + # Make it a bootable volume. + volume['bootable'] = True + # Add the image_id metadata. + volume['volume_image_metadata'] = { + # There would normally be more image metadata in here... + 'image_id': '155d900f-4e14-4e4c-a73d-069cbf4541e6' + } + return volume def fake_initialize_connection(self, context, volume_id, connector):