From: John Griffith Date: Sun, 29 Sep 2013 16:01:58 +0000 (-0600) Subject: Add debug logging for targets X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=15fba9a776a2a85c81679817b20b06ffecc66b6b;p=openstack-build%2Fcinder-build.git Add debug logging for targets Seems we may be failing target create silently, the situation appears to be that the actual device lun is not created. This has been appearing in the gates on create from snapshot. This change adds some logging that will help us determine if it's the actual create, or if it's the attempted update while the dd process is possibly holding the volume in a busy state causing the target update to add lun 1 to fail. Change-Id: If5d4219dedae4649982fa9c13f131bf5f38fb7c4 --- diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py index 18a5a3907..50e417c7d 100644 --- a/cinder/brick/iscsi/iscsi.py +++ b/cinder/brick/iscsi/iscsi.py @@ -167,6 +167,18 @@ class TgtAdm(TargetAdmin): '--update', name, run_as_root=True) + # Grab targets list for debug + # Consider adding a check for lun 0 and 1 for tgtadm + # before considering this as valid + (out, err) = self._execute('tgtadm', + '--lld', + 'iscsi', + '--op', + 'show', + '--mode', + 'target', + run_as_root=True) + LOG.debug("Targets after update: %s" % out) except putils.ProcessExecutionError as e: LOG.error(_("Failed to create iscsi target for volume " "id:%(vol_id)s: %(e)s") diff --git a/cinder/tests/test_iscsi.py b/cinder/tests/test_iscsi.py index 116b8b3cc..71873ff24 100644 --- a/cinder/tests/test_iscsi.py +++ b/cinder/tests/test_iscsi.py @@ -67,8 +67,8 @@ class TargetAdminTestCase(object): def verify_cmds(self, cmds): self.assertEqual(len(cmds), len(self.cmds)) - for a, b in zip(cmds, self.cmds): - self.assertEqual(a, b) + for cmd in self.cmds: + self.assertTrue(cmd in cmds) def verify(self): script = self.get_script() @@ -105,7 +105,8 @@ class TgtAdmTestCase(test.TestCase, TargetAdminTestCase): self.script_template = "\n".join([ 'tgt-admin --update iqn.2011-09.org.foo.bar:blaa', 'tgt-admin --force ' - '--delete iqn.2010-10.org.openstack:volume-blaa']) + '--delete iqn.2010-10.org.openstack:volume-blaa', + 'tgtadm --lld iscsi --op show --mode target']) def tearDown(self): try: