Boot from image destination - volume

Added class DriverImageBlockDevice that implements
creating volume from image on booting VM
from image if destination_type is volume.

Adding converting to legacy if source is image and
destination is a volume.

Change-Id: I8b8a7a2e40c083c18c4808b6b340360138086c1f
blueprint: improve-block-device-handling
This commit is contained in:
Yulia Portnova
2013-08-07 14:58:33 +03:00
committed by Nikola Dipanov
parent dc2a196642
commit 09532a6f02
5 changed files with 186 additions and 25 deletions

View File

@@ -203,6 +203,7 @@ class BlockDeviceDict(dict):
for field in copy_over_fields if field in self)
source_type = self.get('source_type')
destination_type = self.get('destination_type')
no_device = self.get('no_device')
if source_type == 'blank':
if self['guest_format'] == 'swap':
@@ -214,9 +215,11 @@ class BlockDeviceDict(dict):
elif source_type in ('volume', 'snapshot') or no_device:
legacy_block_device['virtual_name'] = None
elif source_type == 'image':
# NOTE(ndipanov): Image bdms have no meaning in
# the legacy format - raise
raise exception.InvalidBDMForLegacy()
if destination_type != 'volume':
# NOTE(ndipanov): Image bdms with local destination
# have no meaning in the legacy format - raise
raise exception.InvalidBDMForLegacy()
legacy_block_device['virtual_name'] = None
return legacy_block_device