Created
June 2, 2016 17:08
-
-
Save WaltHP/12d86a9edf7c21b50d2aff443056dfc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nova/compute/api.py b/nova/compute/api.py | |
index b021152..bc914ac 100644 | |
--- a/nova/compute/api.py | |
+++ b/nova/compute/api.py | |
@@ -1270,6 +1270,8 @@ class API(base.Base): | |
snapshot_id = bdm.snapshot_id | |
volume_id = bdm.volume_id | |
image_id = bdm.image_id | |
+ import pprint | |
+ LOG.warning("BDM %s" % pprint.pformat(vars(bdm))) | |
if (image_id is not None and | |
image_id != instance.get('image_ref')): | |
try: | |
@@ -1285,14 +1287,26 @@ class API(base.Base): | |
elif volume_id is not None: | |
try: | |
volume = self.volume_api.get(context, volume_id) | |
- self.volume_api.check_attach(context, | |
- volume, | |
- instance=instance) | |
+ LOG.warning("Checking availability zone and calling reserve") | |
+ self.volume_api.check_availability_zone( | |
+ context, volume, instance=instance) | |
+ LOG.warning("Reserving volume") | |
+ self.volume_api.reserve_volume(context, volume_id) | |
+ LOG.warning("Good to go") | |
bdm.volume_size = volume.get('size') | |
except (exception.CinderConnectionFailed, | |
exception.InvalidVolume): | |
raise | |
- except Exception: | |
+ except exception.InvalidInput as ex: | |
+ import pprint | |
+ LOG.error(ex) | |
+ LOG.error(pprint.pformat(ex)) | |
+ raise exception.InvalidVolume(reason=ex.message) | |
+ | |
+ except Exception as ex: | |
+ import pprint | |
+ LOG.error(ex) | |
+ LOG.error(pprint.pformat(ex)) | |
raise exception.InvalidBDMVolume(id=volume_id) | |
elif snapshot_id is not None: | |
try: | |
diff --git a/nova/virt/block_device.py b/nova/virt/block_device.py | |
index e86abb7..2ac932e 100644 | |
--- a/nova/virt/block_device.py | |
+++ b/nova/virt/block_device.py | |
@@ -251,8 +251,8 @@ class DriverVolumeBlockDevice(DriverBlockDevice): | |
def attach(self, context, instance, volume_api, virt_driver, | |
do_check_attach=True, do_driver_attach=False, **kwargs): | |
volume = volume_api.get(context, self.volume_id) | |
- if do_check_attach: | |
- volume_api.check_attach(context, volume, instance=instance) | |
+ #if do_check_attach: | |
+ # volume_api.check_attach(context, volume, instance=instance) | |
volume_id = volume['id'] | |
context = context.elevated() | |
@@ -490,12 +490,17 @@ def attach_block_devices(block_device_mapping, *attach_args, **attach_kwargs): | |
def _log_and_attach(bdm): | |
context = attach_args[0] | |
instance = attach_args[1] | |
- if bdm.get('volume_id'): | |
+ LOG.warning("WALT:attach_block_devices: %s" % bdm) | |
+ LOG.warning("WALT:attach_block_devices: %s" % vars(bdm)) | |
+ LOG.warning("Get volume_id %s" % bdm.get('volume_id')) | |
+ LOG.warning("Get volume_id %s" % bdm.volume_id) | |
+ if bdm.volume_id: | |
LOG.info(_LI('Booting with volume %(volume_id)s at ' | |
'%(mountpoint)s'), | |
{'volume_id': bdm.volume_id, | |
'mountpoint': bdm['mount_device']}, | |
context=context, instance=instance) | |
+ attach_kwargs['do_check_attach'] = False | |
elif bdm.get('snapshot_id'): | |
LOG.info(_LI('Booting with volume snapshot %(snapshot_id)s at ' | |
'%(mountpoint)s'), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment