summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-07-09 13:37:01 -0700
committerDan Smith <danms@us.ibm.com>2012-07-10 07:20:13 -0700
commitab7e4f2817d8201cd2364cf09aa01f505e911183 (patch)
treee546088382a0aef71004dee4f2daef93f678d8e0
parentec3bcae984468b162ad40c208a81bf2b77d8b942 (diff)
downloadnova-ab7e4f2817d8201cd2364cf09aa01f505e911183.tar.gz
nova-ab7e4f2817d8201cd2364cf09aa01f505e911183.tar.xz
nova-ab7e4f2817d8201cd2364cf09aa01f505e911183.zip
When deleting an instance, avoid freakout if iscsi device is gone
It's fairly easy to get into a state where an instance is not running, the iscsi infrastructure has been torn down, and the instance cannot be deleted because the iscsi device cannot be successfully removed. This patch ignores the associated return value for that scenario and marches forward in the teardown process. Fixes bug 1022520 Change-Id: Ib28790892eebe341ac10a92250cf872605fefe9b
-rw-r--r--nova/virt/libvirt/volume.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/nova/virt/libvirt/volume.py b/nova/virt/libvirt/volume.py
index dfba9325c..f5a346ca7 100644
--- a/nova/virt/libvirt/volume.py
+++ b/nova/virt/libvirt/volume.py
@@ -108,10 +108,11 @@ class LibvirtISCSIVolumeDriver(LibvirtVolumeDriver):
(iscsi_command, out, err))
return (out, err)
- def _iscsiadm_update(self, iscsi_properties, property_key, property_value):
+ def _iscsiadm_update(self, iscsi_properties, property_key, property_value,
+ **kwargs):
iscsi_command = ('--op', 'update', '-n', property_key,
'-v', property_value)
- return self._run_iscsiadm(iscsi_properties, iscsi_command)
+ return self._run_iscsiadm(iscsi_properties, iscsi_command, **kwargs)
@utils.synchronized('connect_volume')
def connect_volume(self, connection_info, mount_device):
@@ -197,7 +198,8 @@ class LibvirtISCSIVolumeDriver(LibvirtVolumeDriver):
devices = self.connection.get_all_block_devices()
devices = [dev for dev in devices if dev.startswith(device_prefix)]
if not devices:
- self._iscsiadm_update(iscsi_properties, "node.startup", "manual")
+ self._iscsiadm_update(iscsi_properties, "node.startup", "manual",
+ check_exit_code=[0, 255])
self._run_iscsiadm(iscsi_properties, ("--logout",),
check_exit_code=[0, 255])
self._run_iscsiadm(iscsi_properties, ('--op', 'delete'),