Fix failed iscsi tgt delete errors with new tgtadm

Now that the tgtadm patches are working, one problem was detected
The delete target operation would fail, and as a result lvremove
would fail due to an open connection.

There were a number of issue using the config file method, but
the most reliable way is to just use the iqn since we're going
to perform an os.unlink on the config file anyway.

devstack volumes.sh tests now pass and the detach/delete
calls are succesful.

Adjust test_iscsi for modifications to delete

Change-Id: Ic34ca2194b8d75fb84a06dfba6793106eb8055fe
This commit is contained in:
John Griffith
2012-07-31 18:57:42 -06:00
parent 01c80d0929
commit b6ae3c6874

View File

@@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import os.path
import string
from nova import test
@@ -32,6 +33,8 @@ class TargetAdminTestCase(object):
self.vol_id = 'blaa'
self.script_template = None
self.stubs.Set(os.path, 'isfile', lambda _: True)
self.stubs.Set(os, 'unlink', lambda _: '')
def get_script_params(self):
return {'tid': self.tid,
@@ -87,7 +90,7 @@ class TgtAdmTestCase(test.TestCase, TargetAdminTestCase):
self.script_template = "\n".join([
"tgt-admin --execute --conf ./blaa --update blaa",
"tgtadm --op show --lld=iscsi --mode=target --tid=1",
"tgt-admin --conf ./blaa --delete blaa"])
"tgt-admin --delete iqn.2010-10.org.openstack:volume-blaa"])
class IetAdmTestCase(test.TestCase, TargetAdminTestCase):