Skip to content

Commit

Permalink
libvirt: Improve the idempotency of iscsi detach
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vishvananda committed Sep 27, 2012
1 parent a6aee36 commit 628a993
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nova/virt/libvirt/volume.py
Expand Up @@ -199,8 +199,8 @@ def disconnect_volume(self, connection_info, mount_device):
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])

0 comments on commit 628a993

Please sign in to comment.