Zhou Zheng Sheng has uploaded a new change for review.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
functional tests: Wait till backend server of storage connection reference is connected
Storage connection reference performs the actual connecting in asynchronous manner, so add a retryAssert on the storage connection status to wait it gets connected. Otherwise the creation of storage domain will fail if the backend connection in VDSM is not ready.
Extract a super class for backend servers in functional test, the waiting for the ready of the connection is put in the super class, because this waiting can be useful to iscsi and glusterfs testing.
Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Signed-off-by: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com --- M tests/functional/xmlrpcTests.py 1 file changed, 36 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/10352/1
diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py index c259533..482266e 100644 --- a/tests/functional/xmlrpcTests.py +++ b/tests/functional/xmlrpcTests.py @@ -24,6 +24,7 @@ import grp import shutil from contextlib import contextmanager +from functools import partial
from testrunner import VdsmTestCase as TestCaseBase from nose.plugins.skip import SkipTest @@ -336,11 +337,44 @@ self.retryAssert(assertTaskOK, timeout=20)
-class LocalFSServer(object): +class BackendServer(object): + '''Super class of various backend servers''' + def __init__(self, vdsmServer, asserts): self.s = vdsmServer self.asserts = asserts
+ def _createBackend(self, backendDef, rollback): + raise RuntimeError("Not implemented") + + def _assertBackendConnected(self, connections): + r = self.s.storageServer_ConnectionRefs_statuses() + self.asserts.assertVdsOK(r) + status = r['connectionslist'] + for refid in connections: + self.asserts.assertEquals(status[refid]['connected'], True) + + def _connectBackend(self, connections, rollback): + r = self.s.storageServer_ConnectionRefs_acquire(connections) + self.asserts.assertVdsOK(r) + undo = lambda: self.asserts.assertVdsOK( + self.s.storageServer_ConnectionRefs_release(connections.keys())) + rollback.prependDefer(undo) + for _refid, status in r['results'].iteritems(): + self.asserts.assertEquals(status, 0) + self.asserts.retryAssert( + partial(self._assertBackendConnected, connections), timeout=40) + + def _genTypeSpecificArgs(self, connections, rollback): + raise RuntimeError("Not implemented") + + def prepare(self, backendDef, rollback): + connections = self._createBackend(backendDef, rollback) + self._connectBackend(connections, rollback) + return self._genTypeSpecificArgs(connections, rollback) + + +class LocalFSServer(BackendServer): def _createBackend(self, backendDef, rollback): uid = pwd.getpwnam(VDSM_USER)[2] gid = grp.getgrnam(VDSM_GROUP)[2] @@ -365,31 +399,14 @@
return connections
- def _connectBackend(self, connections, rollback): - r = self.s.storageServer_ConnectionRefs_acquire(connections) - self.asserts.assertVdsOK(r) - undo = lambda: self.asserts.assertVdsOK( - self.s.storageServer_ConnectionRefs_release(connections.keys())) - rollback.prependDefer(undo) - for _refid, status in r['results'].iteritems(): - self.asserts.assertEquals(status, 0) - def _genTypeSpecificArgs(self, connections, rollback): args = {} for uuid, conn in connections.iteritems(): args[uuid] = conn['params']['path'] return args
- def prepare(self, backendDef, rollback): - connections = self._createBackend(backendDef, rollback) - self._connectBackend(connections, rollback) - return self._genTypeSpecificArgs(connections, rollback)
- -class IscsiServer(object): - def __init__(self, vdsmServer): - self.s = vdsmServer - +class IscsiServer(BackendServer): def _createBackend(self, backendDef, rollback): # Create iscsi target pass
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 1: Verified
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com
Deepak C Shetty has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 1: Looks good to me, but someone else must approve
(1 inline comment)
Provided one suggestion, to help improve how timeout can be tweaked by different backened based on their complex setup/connection logic. Pls have a loook.
.................................................... File tests/functional/xmlrpcTests.py Line 363: for _refid, status in r['results'].iteritems(): Line 364: self.asserts.assertEquals(status, 0) Line 365: self.asserts.retryAssert( Line 366: partial(self._assertBackendConnected, connections), timeout=40) Line 367: I like the concept of BackendServer superclass. Good thinking. I am not sure if timeout=40 is less/more for all different types of backend. It depends, so hardcoding is not good here. How about getting timeout using a function, so that different backends can override and provide optimum value as needed. For eg: _connectBackendTimeout() will return 40 and it can be overridden by derived class if need be. Alternatively, we can have the 'connections' dict returned by _createBackend() have 'timeout' as a key with the appropriate value filled in by the derived class, if its not present, u can default to 40. This helps different backend tweak the default timeout as needed. Line 368: def _genTypeSpecificArgs(self, connections, rollback): Line 369: raise RuntimeError("Not implemented") Line 370: Line 371: def prepare(self, backendDef, rollback):
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/643/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/608/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Zhou Zheng Sheng has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 1: (1 inline comment)
.................................................... File tests/functional/xmlrpcTests.py Line 363: for _refid, status in r['results'].iteritems(): Line 364: self.asserts.assertEquals(status, 0) Line 365: self.asserts.retryAssert( Line 366: partial(self._assertBackendConnected, connections), timeout=40) Line 367: Thanks Deepak, I update the patch according to your suggestions, it's very helpful. Line 368: def _genTypeSpecificArgs(self, connections, rollback): Line 369: raise RuntimeError("Not implemented") Line 370: Line 371: def prepare(self, backendDef, rollback):
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/608/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/643/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Zhou Zheng Sheng has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 2: Verified
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Deepak C Shetty has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 2: Looks good to me, but someone else must approve
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Ayal Baron has posted comments on this change.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
Patch Set 2: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: functional tests: Wait till backend server of storage connection reference is connected ......................................................................
functional tests: Wait till backend server of storage connection reference is connected
Storage connection reference performs the actual connecting in asynchronous manner, so add a retryAssert on the storage connection status to wait it gets connected. Otherwise the creation of storage domain will fail if the backend connection in VDSM is not ready.
Extract a super class for backend servers in functional test, the waiting for the ready of the connection is put in the super class, because this waiting can be useful to iscsi and glusterfs testing.
Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Signed-off-by: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com --- M tests/functional/xmlrpcTests.py 1 file changed, 47 insertions(+), 25 deletions(-)
Approvals: Ayal Baron: Looks good to me, approved Dan Kenigsberg: Deepak C Shetty: Looks good to me, but someone else must approve Zhou Zheng Sheng: Verified
-- To view, visit http://gerrit.ovirt.org/10352 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I466b8e8cbfe6e1b04f8ad902f54fa1177b746feb Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Deepak C Shetty deepakcs@linux.vnet.ibm.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org