From: Sage Weil Date: Tue, 18 May 2021 13:57:12 +0000 (-0500) Subject: qa/tasks/rook: more orderly cluster teardown X-Git-Tag: v17.1.0~1921^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=539cd362dde182bc78f750b62750d3fac82e8748;p=ceph.git qa/tasks/rook: more orderly cluster teardown Signed-off-by: Sage Weil --- diff --git a/qa/tasks/rook.py b/qa/tasks/rook.py index 0230f2778bff5..ef21a5b880b4d 100644 --- a/qa/tasks/rook.py +++ b/qa/tasks/rook.py @@ -277,8 +277,34 @@ def rook_cluster(ctx, config): finally: _kubectl(ctx, config, ['delete', '-f', 'cluster.yaml'], check_status=False) - _kubectl(ctx, config, ['delete', 'configmap', 'rook-config-override'], - check_status=False) + + # wait for cluster to shut down + log.info('Waiting for cluster to stop') + running = True + with safe_while(sleep=5, tries=100, action="wait for teardown") as proceed: + while running and proceed(): + p = _kubectl( + ctx, config, + ['-n', 'rook-ceph', 'get', 'pods'], + stdout=BytesIO(), + ) + running = False + for line in p.stdout.getvalue().decode('utf-8').strip().splitlines(): + name, ready, status, _ = line.split(None, 3) + if ( + name != 'NAME' + and not name.startswith('csi-') + and not name.startswith('rook-ceph-operator-') + and not name.startswith('rook-ceph-tools-') + ): + running = True + break + + _kubectl( + ctx, config, + ['-n', 'rook-ceph', 'delete', 'configmap', 'rook-config-override'], + check_status=False, + ) ctx.rook[cluster_name].remote.run(args=['rm', '-f', 'cluster.yaml'])