virt: make sure convert_all_volumes catches blank volumes too

convert_all_volumes would skip over blanks. This patch makes sure it
will consider them now too.

The patch (42ea00ee) that introduces the method for some reason
completely missed the Blank volume type.

Closes-bug: #1451950

Change-Id: I146a9bb09c149db1bab6dc13c082b00e5de8b764
This commit is contained in:
Nikola Dipanov
2015-05-05 18:21:18 +01:00
parent 51bdf76b50
commit 13ce6b5eff
2 changed files with 8 additions and 3 deletions

View File

@@ -662,9 +662,12 @@ class TestDriverBlockDevice(test.NoDBTestCase):
self.assertEqual([], converted)
converted = driver_block_device.convert_all_volumes(
self.volume_bdm, self.ephemeral_bdm, self.image_bdm)
self.volume_bdm, self.ephemeral_bdm, self.image_bdm,
self.blank_bdm, self.snapshot_bdm)
self.assertEqual(converted, [self.volume_driver_bdm,
self.image_driver_bdm])
self.image_driver_bdm,
self.blank_driver_bdm,
self.snapshot_driver_bdm])
def test_convert_volume(self):
self.assertIsNone(driver_block_device.convert_volume(self.swap_bdm))

View File

@@ -408,9 +408,11 @@ def convert_all_volumes(*volume_bdms):
source_volume = convert_volumes(volume_bdms)
source_snapshot = convert_snapshots(volume_bdms)
source_image = convert_images(volume_bdms)
source_blank = convert_blanks(volume_bdms)
return [vol for vol in
itertools.chain(source_volume, source_snapshot, source_image)]
itertools.chain(source_volume, source_snapshot,
source_image, source_blank)]
def convert_volume(volume_bdm):