]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/vstart_runner.py: add an option to teardown cluster
authorRishabh Dave <ridave@redhat.com>
Sat, 17 Aug 2019 06:35:33 +0000 (12:05 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 25 Sep 2019 06:39:58 +0000 (12:09 +0530)
Add "--teardown" option so that vstart_runner.py tears down Ceph
cluster automatically after the batch of tests has completed running.
Also delete build/dev and build/out directories, after running stop.sh.

Update the doc for vstart_runner.py as well.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
doc/dev/developer_guide/index.rst
qa/tasks/vstart_runner.py

index c113b3e795670fb7ec94e93a93751a18359115aa..e799801873ca0d0836c0edf035f4ad8abda714fc 100644 (file)
@@ -1636,6 +1636,8 @@ vstart_runner.py can take 3 options -
 --create-cluster-only       creates the cluster and quits; tests can be issued
                             later
 --interactive               drops a Python shell when a test fails
+--teardown                  tears Ceph cluster down after test(s) has finished
+                            runnng
 
 Internal working of vstart_runner.py -
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index d0b5f6f8aca6ab7bf7d49ee1c50887bd0a9fb3e1..b2979e43d6a03a6429c296ad2820fcf89ef94b02 100644 (file)
@@ -987,12 +987,18 @@ class LocalContext(object):
     def __del__(self):
         shutil.rmtree(self.teuthology_config['test_path'])
 
+def _teardown_cluster():
+    log.info('\ntearing down the cluster...')
+    remote.run(args = [os.path.join(SRC_PREFIX, "stop.sh")])
+    remote.run(args = ['rm', '-rf', './dev', './out'])
+
 def exec_test():
     # Parse arguments
     interactive_on_error = False
     create_cluster = False
     create_cluster_only = False
     ignore_missing_binaries = False
+    teardown_cluster = False
 
     args = sys.argv[1:]
     flags = [a for a in args if a.startswith("-")]
@@ -1006,6 +1012,8 @@ def exec_test():
             create_cluster_only = True
         elif f == "--ignore-missing-binaries":
             ignore_missing_binaries = True
+        elif f == '--teardown':
+            teardown_cluster = True
         else:
             log.error("Unknown option '{0}'".format(f))
             sys.exit(-1)
@@ -1022,6 +1030,7 @@ def exec_test():
     max_required_mds, max_required_clients, \
             max_required_mgr, require_memstore = scan_tests(modules)
 
+    global remote
     remote = LocalRemote()
 
     # Tolerate no MDSs or clients running at start
@@ -1039,9 +1048,7 @@ def exec_test():
     if create_cluster or create_cluster_only:
         log.info("Creating cluster with {0} MDS daemons".format(
             max_required_mds))
-        remote.run([os.path.join(SRC_PREFIX, "stop.sh")], check_status=False)
-        remote.run(["rm", "-rf", "./out"])
-        remote.run(["rm", "-rf", "./dev"])
+        _teardown_cluster()
         vstart_env = os.environ.copy()
         vstart_env["FS"] = "0"
         vstart_env["MDS"] = max_required_mds.__str__()
@@ -1211,6 +1218,9 @@ def exec_test():
         verbosity=2,
         failfast=True).run(overall_suite)
 
+    if teardown_cluster:
+        _teardown_cluster()
+
     if not result.wasSuccessful():
         result.printErrors()  # duplicate output at end for convenience