From 628a993ce29cfdee00463c16b932f23e30bc52bf Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 27 Sep 2012 12:32:32 -0700 Subject: libvirt: Improve the idempotency of iscsi detach When detaching an iscsi volume it is possible for the iscsi commands to run concurrently, causing a target to be deleted by one greenthread while the other is continuing. When removing the iscsi connection, we should always ignore exit code 21 because that means that the target has already been removed. Fixes bug 1057719 Change-Id: I0c9f2623f85a817e2be506f9a6d523d45c76848a --- nova/virt/libvirt/volume.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova') diff --git a/nova/virt/libvirt/volume.py b/nova/virt/libvirt/volume.py index 941fd4924..cf08ea85e 100644 --- a/nova/virt/libvirt/volume.py +++ b/nova/virt/libvirt/volume.py @@ -199,8 +199,8 @@ class LibvirtISCSIVolumeDriver(LibvirtVolumeDriver): devices = [dev for dev in devices if dev.startswith(device_prefix)] if not devices: self._iscsiadm_update(iscsi_properties, "node.startup", "manual", - check_exit_code=[0, 255]) + check_exit_code=[0, 21, 255]) self._run_iscsiadm(iscsi_properties, ("--logout",), - check_exit_code=[0, 255]) + check_exit_code=[0, 21, 255]) self._run_iscsiadm(iscsi_properties, ('--op', 'delete'), check_exit_code=[0, 21, 255]) -- cgit