]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add debug logging for targets
authorJohn Griffith <john.griffith@solidfire.com>
Sun, 29 Sep 2013 16:01:58 +0000 (10:01 -0600)
committerJohn Griffith <john.griffith@solidfire.com>
Sun, 29 Sep 2013 16:41:32 +0000 (10:41 -0600)
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

cinder/brick/iscsi/iscsi.py
cinder/tests/test_iscsi.py

index 18a5a39071f6e285710ca0e5cad684bc8ffd3c19..50e417c7d401a7d9adad48170962f22935a8f670 100644 (file)
@@ -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")
index 116b8b3cc650555a856d998db860a48544c95306..71873ff2440e05940b429c3a63618ed19e499bb8 100644 (file)
@@ -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: