Add regression test for rebuilding a volume-backed server
Commit 984dd8ad6add4523d93c7ce5a666a32233e02e34 makes rebuild check to see if the user is rebuilding an instance with a new image and if so, to run the scheduler filters again since the new image might not work with the current host for the instance, and we rebuild to the same host that the instance is already running on. The problem is the instance.image_ref attribute is not set for a volume-backed (boot-from-volume) instance, so the conditional in the rebuild() method is always True, which means we always run through the scheduler for volume-backed instances during rebuild, even if the image in the root disk isn't changing. This adds a functional regression test to recreate the bug. Change-Id: If79c554b46c44a7f70f8367426e7da362d7234c8 Related-Bug: #1732947
This commit is contained in:
parent
78d87f0ddc
commit
22cf178fd7
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user