]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: deepsea: add test yaml and tweak task
authorNathan Cutler <ncutler@suse.com>
Mon, 5 Jun 2017 15:08:43 +0000 (17:08 +0200)
committerNathan Cutler <ncutler@suse.com>
Sat, 10 Jun 2017 14:21:02 +0000 (16:21 +0200)
* adds test yaml in qa/deepsea/basic
* adds exec property
* adds documentation
* after cloning the DeepSea git repo, print the branch name and sha1
  so we have it in the log for verification.
* clone with --depth 1

Signed-off-by: Nathan Cutler <ncutler@suse.com>
24 files changed:
qa/deepsea/2disks.yaml [new file with mode: 0644]
qa/deepsea/2nodes.yaml [new file with mode: 0644]
qa/deepsea/3nodes.yaml [new file with mode: 0644]
qa/deepsea/4nodes.yaml [new file with mode: 0644]
qa/deepsea/health-mds.yaml [new file with mode: 0644]
qa/deepsea/health-ok.yaml [new file with mode: 0644]
qa/suites/deepsea-test.yaml [new file with mode: 0644]
qa/suites/deepsea/basic/2nodes/health-mds/+ [new file with mode: 0644]
qa/suites/deepsea/basic/2nodes/health-mds/2disks.yaml [new symlink]
qa/suites/deepsea/basic/2nodes/health-mds/2nodes.yaml [new symlink]
qa/suites/deepsea/basic/2nodes/health-mds/health-mds.yaml [new symlink]
qa/suites/deepsea/basic/2nodes/health-ok/+ [new file with mode: 0644]
qa/suites/deepsea/basic/2nodes/health-ok/2disks.yaml [new symlink]
qa/suites/deepsea/basic/2nodes/health-ok/2nodes.yaml [new symlink]
qa/suites/deepsea/basic/2nodes/health-ok/health-ok.yaml [new symlink]
qa/suites/deepsea/basic/3nodes/health-mds/+ [new file with mode: 0644]
qa/suites/deepsea/basic/3nodes/health-mds/2disks.yaml [new symlink]
qa/suites/deepsea/basic/3nodes/health-mds/3nodes.yaml [new symlink]
qa/suites/deepsea/basic/3nodes/health-mds/health-mds.yaml [new symlink]
qa/suites/deepsea/basic/3nodes/health-ok/+ [new file with mode: 0644]
qa/suites/deepsea/basic/3nodes/health-ok/2disks.yaml [new symlink]
qa/suites/deepsea/basic/3nodes/health-ok/3nodes.yaml [new symlink]
qa/suites/deepsea/basic/3nodes/health-ok/health-ok.yaml [new symlink]
qa/tasks/deepsea.py

diff --git a/qa/deepsea/2disks.yaml b/qa/deepsea/2disks.yaml
new file mode 100644 (file)
index 0000000..f794a6f
--- /dev/null
@@ -0,0 +1,4 @@
+openstack:
+- volumes: # attached to each instance
+    count: 2
+    size: 10 # GB
diff --git a/qa/deepsea/2nodes.yaml b/qa/deepsea/2nodes.yaml
new file mode 100644 (file)
index 0000000..3635a93
--- /dev/null
@@ -0,0 +1,4 @@
+ceph_cm: salt
+roles:
+- [master.a]
+- [node.1]
diff --git a/qa/deepsea/3nodes.yaml b/qa/deepsea/3nodes.yaml
new file mode 100644 (file)
index 0000000..5aa6c97
--- /dev/null
@@ -0,0 +1,5 @@
+ceph_cm: salt
+roles:
+- [master.a]
+- [node.1]
+- [node.2]
diff --git a/qa/deepsea/4nodes.yaml b/qa/deepsea/4nodes.yaml
new file mode 100644 (file)
index 0000000..573dcb0
--- /dev/null
@@ -0,0 +1,6 @@
+ceph_cm: salt
+roles:
+- [master.a]
+- [node.1]
+- [node.2]
+- [node.3]
diff --git a/qa/deepsea/health-mds.yaml b/qa/deepsea/health-mds.yaml
new file mode 100644 (file)
index 0000000..bdb3cfd
--- /dev/null
@@ -0,0 +1,10 @@
+tasks:
+- install:
+- deepsea:
+    repo: https://github.com/smithfarm/DeepSea.git
+    branch: wip-qa-suite
+    exec:
+    - suites/basic/health-mds.sh
+#- exec:
+#    master.a:
+#      - sleep 1000000000 # forever
diff --git a/qa/deepsea/health-ok.yaml b/qa/deepsea/health-ok.yaml
new file mode 100644 (file)
index 0000000..8a65699
--- /dev/null
@@ -0,0 +1,8 @@
+tasks:
+- install:
+- deepsea:
+    repo: https://github.com/smithfarm/DeepSea.git
+    branch: wip-qa-suite
+#- exec:
+#    master.a:
+#      - sleep 1000000000 # forever
diff --git a/qa/suites/deepsea-test.yaml b/qa/suites/deepsea-test.yaml
new file mode 100644 (file)
index 0000000..f5a93e4
--- /dev/null
@@ -0,0 +1,16 @@
+ceph_cm: salt
+roles:
+- [master.a]
+- [node.1]
+openstack:
+- volumes: # attached to each instance
+    count: 2
+    size: 10 # GB
+tasks:
+- install:
+- deepsea:
+    repo: https://github.com/smithfarm/DeepSea.git
+    branch: wip-qa-suite
+#- exec:
+#    master.a:
+#      - sleep 1000000000 # forever
diff --git a/qa/suites/deepsea/basic/2nodes/health-mds/+ b/qa/suites/deepsea/basic/2nodes/health-mds/+
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/qa/suites/deepsea/basic/2nodes/health-mds/2disks.yaml b/qa/suites/deepsea/basic/2nodes/health-mds/2disks.yaml
new file mode 120000 (symlink)
index 0000000..610e5ed
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/2disks.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/2nodes/health-mds/2nodes.yaml b/qa/suites/deepsea/basic/2nodes/health-mds/2nodes.yaml
new file mode 120000 (symlink)
index 0000000..af3f574
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/2nodes.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/2nodes/health-mds/health-mds.yaml b/qa/suites/deepsea/basic/2nodes/health-mds/health-mds.yaml
new file mode 120000 (symlink)
index 0000000..62622e0
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/health-mds.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/2nodes/health-ok/+ b/qa/suites/deepsea/basic/2nodes/health-ok/+
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/qa/suites/deepsea/basic/2nodes/health-ok/2disks.yaml b/qa/suites/deepsea/basic/2nodes/health-ok/2disks.yaml
new file mode 120000 (symlink)
index 0000000..610e5ed
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/2disks.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/2nodes/health-ok/2nodes.yaml b/qa/suites/deepsea/basic/2nodes/health-ok/2nodes.yaml
new file mode 120000 (symlink)
index 0000000..af3f574
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/2nodes.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/2nodes/health-ok/health-ok.yaml b/qa/suites/deepsea/basic/2nodes/health-ok/health-ok.yaml
new file mode 120000 (symlink)
index 0000000..6593a88
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/health-ok.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/3nodes/health-mds/+ b/qa/suites/deepsea/basic/3nodes/health-mds/+
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/qa/suites/deepsea/basic/3nodes/health-mds/2disks.yaml b/qa/suites/deepsea/basic/3nodes/health-mds/2disks.yaml
new file mode 120000 (symlink)
index 0000000..610e5ed
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/2disks.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/3nodes/health-mds/3nodes.yaml b/qa/suites/deepsea/basic/3nodes/health-mds/3nodes.yaml
new file mode 120000 (symlink)
index 0000000..b6cef0d
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/3nodes.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/3nodes/health-mds/health-mds.yaml b/qa/suites/deepsea/basic/3nodes/health-mds/health-mds.yaml
new file mode 120000 (symlink)
index 0000000..62622e0
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/health-mds.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/3nodes/health-ok/+ b/qa/suites/deepsea/basic/3nodes/health-ok/+
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/qa/suites/deepsea/basic/3nodes/health-ok/2disks.yaml b/qa/suites/deepsea/basic/3nodes/health-ok/2disks.yaml
new file mode 120000 (symlink)
index 0000000..610e5ed
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/2disks.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/3nodes/health-ok/3nodes.yaml b/qa/suites/deepsea/basic/3nodes/health-ok/3nodes.yaml
new file mode 120000 (symlink)
index 0000000..b6cef0d
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/3nodes.yaml
\ No newline at end of file
diff --git a/qa/suites/deepsea/basic/3nodes/health-ok/health-ok.yaml b/qa/suites/deepsea/basic/3nodes/health-ok/health-ok.yaml
new file mode 120000 (symlink)
index 0000000..6593a88
--- /dev/null
@@ -0,0 +1 @@
+../../../../../deepsea/health-ok.yaml
\ No newline at end of file
index 373bb4a85c6c7319911946a3503e3a91956c6056..d2d62e1e763addc5b7788621ed191d9cd303b484 100644 (file)
@@ -2,6 +2,7 @@
 Task to deploy clusters with DeepSea
 '''
 import logging
+import time
 
 from teuthology import misc
 from teuthology.orchestra import run
@@ -12,16 +13,60 @@ from util import get_remote_for_role
 log = logging.getLogger(__name__)
 
 class DeepSea(Task):
+    """
+    Automated DeepSea integration testing via teuthology: set up a Salt
+    cluster, clone the DeepSea git repo, run DeepSea integration test(s) 
 
+    The number of machines in the cluster is determined by the roles stanza, as
+    usual. One, and only one, of the machines must have a role of type
+    "master", e.g.  master.1 or master.a (the part following the dot is not
+    significant, but must be there).
+
+    The task starts the Salt Master daemon on the master node, and Salt Minion
+    daemons on all the nodes (including the master node), and ensures that the
+    minions are properly linked to the master. TODO: The role types are stored
+    in the role grain on the minions.
+
+    After that, the DeepSea git repo is cloned to the master node (in
+    accordance with the "repo" and "branch" options, if given).
+
+    Finally, the task iterates over the list of commands given in the "exec"
+    property, executing each one inside the 'qa/' directory of the DeepSea repo
+    clone.
+
+    Possible options for this task are:
+
+        repo: (DeepSea git repo, defaults to https://github.com/SUSE/DeepSea.git)
+        branch: (DeepSea git branch, defaults to master)
+        exec: (list of commands, relative to qa/ of the DeepSea repo)
+
+    Example:
+
+        tasks
+        - deepsea:
+            exec:
+            - suites/basic/health-ok.sh
+    """
     def __init__(self, ctx, config):
         super(DeepSea, self).__init__(ctx, config)
 
+        # make sure self.config dict has values for important keys
         if config is None:
             config = {}
         assert isinstance(config, dict), \
             'deepsea task only accepts a dict for configuration'
         self.config["repo"] = config.get('repo', 'https://github.com/SUSE/DeepSea.git')
         self.config["branch"] = config.get('branch', 'master')
+        self.config["exec"] = config.get('exec', ['suites/basic/health-ok.sh'])
+        assert isinstance(self.config["exec"], list), \
+            'exec property of deepsea yaml must be a list'
+
+        # prepare the list of commands to be executed on the master node
+        self.exec_cmd = []
+        assert len(self.config["exec"]) > 0, \
+            'deepsea exec list must have at least one element'
+        for cmd in self.config["exec"]:
+            self.exec_cmd.append('cd DeepSea/qa ; ' + cmd)
 
         # determine the role id of the master role
         if(misc.num_instances_of_type(self.cluster, 'master') != 1):
@@ -34,6 +79,7 @@ class DeepSea(Task):
         # into a string
         self.config["master_remote"] = get_remote_for_role(self.ctx,
                 master_role).name
+        self.log.info("master remote: {}".format(self.config["master_remote"]))
         self.salt = Salt(self.ctx, self.config)
 
     def setup(self):
@@ -41,15 +87,34 @@ class DeepSea(Task):
 
         self.log.info("DeepSea repo: {}".format(self.config["repo"]))
         self.log.info("DeepSea branch: {}".format(self.config["branch"]))
-        self.log.info("master remote: {}".format(self.config["master_remote"]))
 
         self.salt.master_remote.run(args=[
             'git',
             'clone',
+            '--depth',
+            '1',
             '--branch',
             self.config["branch"],
             self.config["repo"],
+            ])
+
+        self.log.info("printing DeepSea branch name and sha1...")
+        self.salt.master_remote.run(args=[
+            'cd',
+            'DeepSea',
             run.Raw(';'),
+            'git',
+            'rev-parse',
+            '--abbrev-ref',
+            'HEAD',
+            run.Raw(';'),
+            'git',
+            'rev-parse',
+            'HEAD',
+            ])
+
+        self.log.info("Running \"make install\" in DeepSea clone...")
+        self.salt.master_remote.run(args=[
             'cd',
             'DeepSea',
             run.Raw(';'),
@@ -81,25 +146,32 @@ class DeepSea(Task):
 
         self.salt.ping_minions()
 
-        self.log.info("listing contents of DeepSea/qa/ directory tree...")
-        self.salt.master_remote.run(args=[
-            'ls',
-            '-lR',
-            '--color=never',
-            'DeepSea/qa/'
-            ])
-
-        self.log.info("running basic-health-ok.sh workunit...")
-        self.salt.master_remote.run(args=[
-            'sudo',
-            'DeepSea/qa/workunits/basic-health-ok.sh'
-            ])
-
-
     def begin(self):
         super(DeepSea, self).begin()
+        for cmd in self.exec_cmd:
+            self.log.info(
+                "command to be executed on master node: {}".format(cmd)
+                )
+            self.salt.master_remote.run(args=[
+                'sudo', 'sh', '-c',
+                cmd
+                ])
 
     def end(self):
+        # replace this hack with DeepSea purge when it's ready
+        for _remote, _ in self.ctx.cluster.remotes.iteritems():
+            self.log.info("stopping OSD services on {}"
+                .format(_remote.hostname))
+            _remote.run(args=[
+                'sudo', 'sh', '-c',
+                'systemctl stop ceph-osd.target ; sleep 10'
+                ])
+            self.log.info("unmounting OSD data devices on {}"
+                .format(_remote.hostname))
+            _remote.run(args=[
+                'sudo', 'sh', '-c',
+                'umount /dev/vdb2 ; umount /dev/vdc2'
+                ])
         super(DeepSea, self).end()
 
 task = DeepSea