Change in vdsm[master]: storage domain creation assertion added

ykleinbe at redhat.com ykleinbe at redhat.com
Tue Aug 26 13:24:09 UTC 2014


Yoav Kleinberger has uploaded a new change for review.

Change subject: storage domain creation assertion added
......................................................................

storage domain creation assertion added

Change-Id: Ib6b3fe56a5f8186c5a28cef75a128bd806c52894
Signed-off-by: Yoav Kleinberger <ykleinbe at redhat.com>
---
M tests/functional/new/basic_storage_domain_test.py
M tests/functional/new/testlib/testcontexts/iscsi.py
2 files changed, 37 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/31986/1

diff --git a/tests/functional/new/basic_storage_domain_test.py b/tests/functional/new/basic_storage_domain_test.py
index df35a8f..bcf5a99 100644
--- a/tests/functional/new/basic_storage_domain_test.py
+++ b/tests/functional/new/basic_storage_domain_test.py
@@ -47,12 +47,9 @@
             vdsm.spmStart()
             verify.spmStarted()
 
-#activateStorageDomain
             vdsm.activateStorageDomain()
-#connectStoragePool again
             GIGABYTE = 1024 ** 3
-#            GIGABYTE = 1024 * 2048
-            taskID = vdsm.createVolume(str(10 * GIGABYTE))
+            taskID = vdsm.createVolume(1 * GIGABYTE)
             try:
                 verify.volumeCreated(taskID)
             finally:
diff --git a/tests/functional/new/testlib/testcontexts/iscsi.py b/tests/functional/new/testlib/testcontexts/iscsi.py
index a1f6c0b..c8c79a8 100644
--- a/tests/functional/new/testlib/testcontexts/iscsi.py
+++ b/tests/functional/new/testlib/testcontexts/iscsi.py
@@ -37,11 +37,17 @@
     def _waitForVDSMToFinishTask(self):
         time.sleep(1)
 
-    def volumeGroupCreated(self):
-        name = self._volumeGroup['uuid']
-        returnCode = subprocess.call([ 'vgs', name ], close_fds = True)
-        assert returnCode == 0, "did not find volume group as expected"
-        
+    def waitFor(self, predicate, description, timeout):
+        logging.info('waiting for "%s"' % description)
+        start = time.time()
+        for _ in xrange(timeout):
+            if predicate():
+                logging.info('it took %s seconds' % (time.time() - start))
+                return
+            time.sleep(1)
+
+        assert False, 'waited %s seconds for "%s" but it did not happen' % (timeout, description)
+
     def storageServerConnected(self):
         targetNameFiles = glob.glob('/sys/devices/platform/host*/session*/iscsi_session/*/targetname')
         targetNames = [ open(file).read().strip() for file in targetNameFiles ]
@@ -55,12 +61,21 @@
         pass
 
     def storageDomainCreated(self, domainID):
-        self._waitForVDSMToFinishTask()
-        pass
+        storageDomainVolumesExist = lambda: self._storageDomainVolumesExist(domainID)
+        self.waitFor(storageDomainVolumesExist, 'storage domain exists', 10)
+
+    def _storageDomainVolumesExist(self, domainID):
+        for name in [ 'ids', 'inbox', 'leases', 'master', 'metadata', 'outbox' ]:
+            doubleDashed = domainID.replace('-', '--')
+            expectedPath = os.path.join('/dev/mapper', '%s-%s' % (doubleDashed, name))
+            logging.info('verifying: %s' % expectedPath)
+            if not os.path.lexists(expectedPath):
+                return False
+
+        return True
 
     def _directIOTestFileExists(self):
         pass
-
 
     def storagePoolCreated(self):
         self._waitForVDSMToFinishTask()
@@ -171,8 +186,10 @@
 
     def createStoragePool(self):
         POOL_TYPE_DEPRECATED = 0
+        self.embed('createStoragePool 1')
         result = self._vdsm.createStoragePool(0, self._poolID, self._randomName('pool'), self._domainID(), [ self._domainID() ], 1)
         self.verifyVDSMSuccess(result)
+        self.embed('createStoragePool 2')
 
     def _domainID(self):
         return self._volumeGroup['uuid']
@@ -208,6 +225,12 @@
         self.connectStorageServer2()
         return self._volumeGroup['uuid']
 
+#####
+    def embed(self,msg):
+        print 'embedding: %s' % msg
+        import IPython
+        IPython.embed()
+
     def _createStorageDomain(self):
         domainID = self._volumeGroup['uuid']
         DOMAIN_VERSION = 3
@@ -215,14 +238,17 @@
         result = self._vdsm.createStorageDomain(storage.sd.ISCSI_DOMAIN, domainID, domainName, self._volumeGroup['vgs_uuid'], storage.sd.DATA_DOMAIN, DOMAIN_VERSION)
         self.verifyVDSMSuccess(result)
 
-    def createVolume(self,size):
+    def createVolume(self, size):
         PREALLOCATE = 1
         result = self._vdsm.createVolume(self._domainID(), self._poolID, self._imageID, 
-                    size, storage.volume.RAW_FORMAT, PREALLOCATE, storage.image.DATA_DISK_TYPE, self._volumeID, self._randomName('description'))
+                    self._stringForXMLRPC(size), storage.volume.RAW_FORMAT, PREALLOCATE, storage.image.DATA_DISK_TYPE, self._volumeID, self._randomName('description'))
         logging.info( 'createVolume result: %s' % result)
         self.verifyVDSMSuccess(result)
         return result[ 'uuid' ]
 
+    def _stringForXMLRPC(self, number):
+        return str(number)
+
     def verifyVDSMSuccess(self, result):
         if result[ 'status' ][ 'code' ] != 0:
             raise Exception('expected OK result from VDSM, got "%s" instead' % str(result))


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6b3fe56a5f8186c5a28cef75a128bd806c52894
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yoav Kleinberger <ykleinbe at redhat.com>


More information about the vdsm-patches mailing list