From: Vishvananda Ishaya Date: Mon, 25 Mar 2013 19:46:51 +0000 (-0700) Subject: Force deletes using tgt to workaround bug 1159948 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b84218633ab5417adf94c568eb54243f4074ab11;p=openstack-build%2Fcinder-build.git Force deletes using tgt to workaround bug 1159948 Tgt has a bug where it can have multiple copies of an initiator if there has been a reconnect. See https://bugs.launchpad.net/cinder/+bug/1159948 Change-Id: I9a1b6757eb780efbaa1403016e50de7c0e45d720 --- diff --git a/cinder/tests/test_iscsi.py b/cinder/tests/test_iscsi.py index 7b1a327d4..b5ea8e49f 100644 --- a/cinder/tests/test_iscsi.py +++ b/cinder/tests/test_iscsi.py @@ -101,7 +101,8 @@ class TgtAdmTestCase(test.TestCase, TargetAdminTestCase): self.flags(volumes_dir=self.persist_tempdir) self.script_template = "\n".join([ 'tgt-admin --update iqn.2011-09.org.foo.bar:blaa', - 'tgt-admin --delete iqn.2010-10.org.openstack:volume-blaa']) + 'tgt-admin --force ' + '--delete iqn.2010-10.org.openstack:volume-blaa']) def tearDown(self): try: diff --git a/cinder/volume/iscsi.py b/cinder/volume/iscsi.py index 77efed470..6fde9d963 100644 --- a/cinder/volume/iscsi.py +++ b/cinder/volume/iscsi.py @@ -190,7 +190,10 @@ class TgtAdm(TargetAdmin): else: raise exception.ISCSITargetRemoveFailed(volume_id=vol_id) try: + # NOTE(vish): --force is a workaround for bug: + # https://bugs.launchpad.net/cinder/+bug/1159948 self._execute('tgt-admin', + '--force', '--delete', iqn, run_as_root=True)