Merge "Replace glance_metadata check with bootable column."

This commit is contained in:
Jenkins
2013-06-25 20:50:35 +00:00
committed by Gerrit Code Review
10 changed files with 191 additions and 24 deletions

View File

@@ -169,9 +169,20 @@ class VolumeManager(manager.SchedulerDependentManager):
model_update = self.driver.create_volume_from_snapshot(
volume_ref,
snapshot_ref)
originating_vref = self.db.volume_get(context,
snapshot_ref['volume_id'])
if originating_vref.bootable:
self.db.volume_update(context,
volume_ref['id'],
{'bootable': True})
elif srcvol_ref is not None:
model_update = self.driver.create_cloned_volume(volume_ref,
srcvol_ref)
if srcvol_ref.bootable:
self.db.volume_update(context,
volume_ref['id'],
{'bootable': True})
else:
# create the volume from an image
cloned = self.driver.clone_image(volume_ref, image_location)
@@ -182,11 +193,16 @@ class VolumeManager(manager.SchedulerDependentManager):
volume_ref = self.db.volume_update(context,
volume_ref['id'],
updates)
# TODO(jdg): Wrap this in a try block and update status
# appropriately if the download image fails
self._copy_image_to_volume(context,
volume_ref,
image_service,
image_id)
self.db.volume_update(context,
volume_ref['id'],
{'bootable': True})
return model_update, cloned
def create_volume(self, context, volume_id, request_spec=None,