Zhou Zheng Sheng has uploaded a new change for review.

Change subject: Fix iSCSI functional tests in Fedora 18
......................................................................

Fix iSCSI functional tests in Fedora 18

There are two fix.

1. modprobe iscsi_target_mod before running tests in Fedora 18

In Fedora 18, iscsi_target_mod is not loaded by default. If the module
is not loaded, the rtslib will fail to configure iSCSI targets for the
storage backend and the test will fail. This patch load the module
explicitly before running the tests.

2. Wait for some time for VDSM to refreshing the device list

If two iSCSI tests are arranged back to back, we should wait for VDSM to
refresh the iSCSI session info. Otherwise the _getIqnDevs method fails.

Change-Id: If0ffd21cbf0b68fa19e4f9a84e399bf2c75039bc
Signed-off-by: Zhou Zheng Sheng <[email protected]>
---
M tests/functional/xmlrpcTests.py
M tests/testrunner.py
2 files changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/12594/1

diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index 95f06a8..54a66b5 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -48,6 +48,7 @@
     raise SkipTest("XML-RPC Bindings are disabled")
 
 _mkinitrd = CommandPath("mkinird", "/usr/bin/mkinitrd")
+_modprobe = CommandPath("modprobe", "/usr/sbin/modprobe")
 
 
 def readableBy(filePath, user):
@@ -424,8 +425,13 @@
 
 class IscsiServer(BackendServer):
     def __init__(self, vdsmServer, asserts):
+        # check if the system supports configuring iSCSI target
         if not "rtslib" in globals().keys():
             raise SkipTest("python-rtslib is not installed.")
+
+        cmd = [_modprobe.cmd, "iscsi_target_mod"]
+        rc, out, err = execCmd(cmd, sudo=True)
+        asserts.assertEquals(rc, 0)
 
         super(IscsiServer, self).__init__(vdsmServer, asserts)
         self.address = '127.0.0.1'
@@ -506,13 +512,16 @@
                     iqnDevs[iqn] = dev['GUID']
                     break
             else:
-                raise RuntimeError(
+                raise AssertionError(
                     'Can not find related device of iqn %s' % iqn)
         return iqnDevs
 
     def _genTypeSpecificArgs(self, connections, rollback):
         iqns = [conn['params']['iqn'] for conn in connections.itervalues()]
-        iqnDevs = self._getIqnDevs(iqns)
+        # If two iSCSI tests are run back to back, it takes VDSM some time to
+        # refresh the iSCSI session info.
+        iqnDevs = self.asserts.retryAssert(partial(self._getIqnDevs, iqns),
+                                           timeout=30)
 
         args = {}
         for uuid, conn in connections.iteritems():
diff --git a/tests/testrunner.py b/tests/testrunner.py
index 2c55a51..f58011a 100644
--- a/tests/testrunner.py
+++ b/tests/testrunner.py
@@ -134,7 +134,7 @@
         # hackVdsmModule() is called. Do not import it at the
         # module level.
         from vdsm.utils import retry
-        retry(expectedException=AssertionError, *args, **kwargs)
+        return retry(expectedException=AssertionError, *args, **kwargs)
 
     def assertRaises(self, excClass, callableObj=None, *args, **kwargs):
         # FIXME: This is a forward port of the assertRaises from python


--
To view, visit http://gerrit.ovirt.org/12594
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0ffd21cbf0b68fa19e4f9a84e399bf2c75039bc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to