Deepak C Shetty has uploaded a new change for review.

Change subject: tests/functional: WIP - Add GlusterSD functional test
......................................................................

tests/functional: WIP - Add GlusterSD functional test

Add functional testcase for glusterSD. This requires a gluster
volume named 'testvol' running on the same system as this test
runs as a pre-req.

Change-Id: Ibe27b138d78e0922a6455e0984813823a98aeb53
Signed-off-by: Deepak C Shetty <[email protected]>
---
M tests/functional/xmlrpcTests.py
1 file changed, 82 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/10196/1

diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index 5584c19..14ea637 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -201,6 +201,11 @@
         with RollbackContext() as rollback:
             self._createVdsmStorageLayout(conf, rollback)
 
+    def testGlusterFS(self):
+        conf = storageLayouts['glusterfs']
+        with RollbackContext() as rollback:
+            self._createVdsmStorageLayout(conf, rollback)
+
     @skipNoKVM
     def testSimpleVMoLocalfs(self):
         localfs = storageLayouts['localfs']
@@ -387,6 +392,55 @@
         return self._genTypeSpecificArgs(connections, rollback)
 
 
+class GlusterFSServer(object):
+    def __init__(self, vdsmServer, asserts):
+        self.s = vdsmServer
+        self.asserts = asserts
+
+    def _createBackend(self, backendDef, rollback):
+        uid = pwd.getpwnam(VDSM_USER)[2]
+        gid = grp.getgrnam(VDSM_GROUP)[2]
+
+        rootDir = tempfile.mkdtemp(prefix='glusterfs')
+        undo = lambda: os.rmdir(rootDir)
+        rollback.prependDefer(undo)
+        os.chown(rootDir, uid, gid)
+        os.chmod(rootDir, 0755)
+
+        connections = {}
+        for uuid, conDict in backendDef.iteritems():
+            spec = conDict['spec']
+            vfstype = conDict['vfstype']
+            options = conDict['options']
+
+            connections[uuid] = {'type': 'glusterfs',
+                                 'params': {'spec': spec,
+                                            'vfsType': vfstype,
+                                            'options': options}}
+
+        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, conDict in connections.iteritems():
+            args[uuid] = conDict['params']['spec']
+        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
@@ -442,6 +496,34 @@
                      "47bd7538-c48b-4b94-ba94-def922151d48"],
                  "9af9bd7f-6167-4ae8-aac6-95a5e5f36f60": [
                      "bace8f68-4c5a-43f2-acb4-fa8daf58c0f9"]}}},
+     'glusterfs':
+         {'server': GlusterFSServer,
+          'conn': {'98a4b463-8e38-4b54-814e-dbf5b5fdf437': {
+              'spec': 'localhost:testvol', 'vfstype': 'glusterfs',
+              'options': ""}},
+          'sd': {
+              '3cca273c-9fe5-4740-aad4-26a94ca13716': {
+                  'name': 'test gluster domain', 'type': 'glusterfs',
+                  'class': 'Data',
+                  'connUUID': '98a4b463-8e38-4b54-814e-dbf5b5fdf437'}},
+          'sp': {
+              '8a098016-9495-4c1b-95da-6ca3238c0cbd': {
+                  'name': 'test gluster storage pool', 'master_ver': 1,
+                  'host': 1,
+                  'master_uuid': '3cca273c-9fe5-4740-aad4-26a94ca13716'}},
+          'img': {
+               '72214f6c-f8c0-41fc-8123-df6d0d6e934d': {
+                   'description': 'test gluster volume', 'type': 'leaf',
+                   'volid': 'c0ca016f-c1a5-4d66-9428-03f7a99c16bc',
+                   'format': 'cow', 'preallocate': 'sparse',
+                   'size': 20971520}},
+          'layout': {
+               # pool
+               '8a098016-9495-4c1b-95da-6ca3238c0cbd': {
+                   # domain(s)
+                   '3cca273c-9fe5-4740-aad4-26a94ca13716': [
+                       # images(s)
+                       '72214f6c-f8c0-41fc-8123-df6d0d6e934d']}}},
      'nfs': {'server': 'blah', 'conn': 'blah', 'sd': 'blah', 'sp': 'blah',
              'img': 'blah', 'layout': 'blah'},
      'iscsi': {'server': 'blah', 'conn': 'blah', 'sd': 'blah', 'sp': 'blah',


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

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

Reply via email to