diff options
| author | Dan Smith <danms@us.ibm.com> | 2012-07-25 10:33:16 -0700 |
|---|---|---|
| committer | Dan Smith <danms@us.ibm.com> | 2012-07-26 07:03:36 -0700 |
| commit | 4810269ef648348bbc7ef9113d4e7faf47b15c55 (patch) | |
| tree | c4b6ee13b9e0e33cbefb82cca25c0552f00151e5 /nova | |
| parent | 71062fe8e061c3f8157b67762c4d190d13351447 (diff) | |
| download | nova-4810269ef648348bbc7ef9113d4e7faf47b15c55.tar.gz nova-4810269ef648348bbc7ef9113d4e7faf47b15c55.tar.xz nova-4810269ef648348bbc7ef9113d4e7faf47b15c55.zip | |
Fix exception handling in libvirt attach_volume()
Currently, the real reason for a failure is dropped when attempting
to unroll the volume connection (with the exception of when it is
VIR_ERR_OPERATION_FAILED). This change uses save_and_reraise_exception()
to correct that so that the actual reason for failure gets logged.
Fixes bug 1029463
Change-Id: Id47db565c4fb5a88d1a263600b41706dd3419726
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/virt/libvirt/driver.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index f0ffa895c..7c8dfae47 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -631,15 +631,18 @@ class LibvirtDriver(driver.ComputeDriver): try: virt_dom.attachDevice(conf.to_xml()) except Exception, ex: - self.volume_driver_method('disconnect_volume', - connection_info, - mount_device) - if isinstance(ex, libvirt.libvirtError): errcode = ex.get_error_code() if errcode == libvirt.VIR_ERR_OPERATION_FAILED: + self.volume_driver_method('disconnect_volume', + connection_info, + mount_device) raise exception.DeviceIsBusy(device=mount_device) - raise + + with excutils.save_and_reraise_exception(): + self.volume_driver_method('disconnect_volume', + connection_info, + mount_device) # TODO(danms) once libvirt has support for LXC hotplug, # replace this re-define with use of the |
