mirror of
https://github.com/ceph/ceph
synced 2025-03-30 23:40:09 +00:00
qa/vstart_runner.py: add an option to teardown cluster
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>
This commit is contained in:
parent
e5b766ed46
commit
83ff993e95
@ -1636,6 +1636,8 @@ vstart_runner.py can take 3 options -
|
|||||||
--create-cluster-only creates the cluster and quits; tests can be issued
|
--create-cluster-only creates the cluster and quits; tests can be issued
|
||||||
later
|
later
|
||||||
--interactive drops a Python shell when a test fails
|
--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 -
|
Internal working of vstart_runner.py -
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -987,12 +987,18 @@ class LocalContext(object):
|
|||||||
def __del__(self):
|
def __del__(self):
|
||||||
shutil.rmtree(self.teuthology_config['test_path'])
|
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():
|
def exec_test():
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
interactive_on_error = False
|
interactive_on_error = False
|
||||||
create_cluster = False
|
create_cluster = False
|
||||||
create_cluster_only = False
|
create_cluster_only = False
|
||||||
ignore_missing_binaries = False
|
ignore_missing_binaries = False
|
||||||
|
teardown_cluster = False
|
||||||
|
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
flags = [a for a in args if a.startswith("-")]
|
flags = [a for a in args if a.startswith("-")]
|
||||||
@ -1006,6 +1012,8 @@ def exec_test():
|
|||||||
create_cluster_only = True
|
create_cluster_only = True
|
||||||
elif f == "--ignore-missing-binaries":
|
elif f == "--ignore-missing-binaries":
|
||||||
ignore_missing_binaries = True
|
ignore_missing_binaries = True
|
||||||
|
elif f == '--teardown':
|
||||||
|
teardown_cluster = True
|
||||||
else:
|
else:
|
||||||
log.error("Unknown option '{0}'".format(f))
|
log.error("Unknown option '{0}'".format(f))
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
@ -1022,6 +1030,7 @@ def exec_test():
|
|||||||
max_required_mds, max_required_clients, \
|
max_required_mds, max_required_clients, \
|
||||||
max_required_mgr, require_memstore = scan_tests(modules)
|
max_required_mgr, require_memstore = scan_tests(modules)
|
||||||
|
|
||||||
|
global remote
|
||||||
remote = LocalRemote()
|
remote = LocalRemote()
|
||||||
|
|
||||||
# Tolerate no MDSs or clients running at start
|
# Tolerate no MDSs or clients running at start
|
||||||
@ -1039,9 +1048,7 @@ def exec_test():
|
|||||||
if create_cluster or create_cluster_only:
|
if create_cluster or create_cluster_only:
|
||||||
log.info("Creating cluster with {0} MDS daemons".format(
|
log.info("Creating cluster with {0} MDS daemons".format(
|
||||||
max_required_mds))
|
max_required_mds))
|
||||||
remote.run([os.path.join(SRC_PREFIX, "stop.sh")], check_status=False)
|
_teardown_cluster()
|
||||||
remote.run(["rm", "-rf", "./out"])
|
|
||||||
remote.run(["rm", "-rf", "./dev"])
|
|
||||||
vstart_env = os.environ.copy()
|
vstart_env = os.environ.copy()
|
||||||
vstart_env["FS"] = "0"
|
vstart_env["FS"] = "0"
|
||||||
vstart_env["MDS"] = max_required_mds.__str__()
|
vstart_env["MDS"] = max_required_mds.__str__()
|
||||||
@ -1211,6 +1218,9 @@ def exec_test():
|
|||||||
verbosity=2,
|
verbosity=2,
|
||||||
failfast=True).run(overall_suite)
|
failfast=True).run(overall_suite)
|
||||||
|
|
||||||
|
if teardown_cluster:
|
||||||
|
_teardown_cluster()
|
||||||
|
|
||||||
if not result.wasSuccessful():
|
if not result.wasSuccessful():
|
||||||
result.printErrors() # duplicate output at end for convenience
|
result.printErrors() # duplicate output at end for convenience
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user