]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephadm_cases/test_cli: fix test_daemon_restart 44107/head
authorSage Weil <sage@newdream.net>
Thu, 25 Nov 2021 14:10:28 +0000 (08:10 -0600)
committerSage Weil <sage@newdream.net>
Mon, 29 Nov 2021 16:24:20 +0000 (10:24 -0600)
We cannot schedule a daemon start if there is another daemon action
with a higher priority (including stop) scheduled.  However,
that state isn't cleared until *after* the osd goes down, the
systemctl command returns, and mgr/cephadm gets around to updating
the inventory scheduled_daemon_action state.

Semi-fix: (1) wait for the orch status to change, and then (2)
wait a few more seconds after that.

Signed-off-by: Sage Weil <sage@newdream.net>
qa/tasks/cephadm_cases/test_cli.py

index 1dcf2f35e69cfbfc420e3fd5a05de82bac2bb76a..c05395673c878222aa9b438b5f550325b7d9f671 100644 (file)
@@ -1,6 +1,9 @@
+import json
 import logging
+import time
 
 from tasks.mgr.mgr_test_case import MgrTestCase
+from teuthology.contextutil import safe_while
 
 log = logging.getLogger(__name__)
 
@@ -48,6 +51,13 @@ class TestCephadmCLI(MgrTestCase):
     def test_daemon_restart(self):
         self._orch_cmd('daemon', 'stop', 'osd.0')
         self.wait_for_health('OSD_DOWN', 30)
+        with safe_while(sleep=1, tries=30) as proceed:
+            while proceed():
+                j = json.loads(self._orch_cmd('ps', '--format', 'json'))
+                d = {d['daemon_name']: d for d in j}
+                if d['osd.0']['status_desc'] != 'running':
+                    break
+        time.sleep(5)
         self._orch_cmd('daemon', 'start', 'osd.0')
         self.wait_for_health_clear(90)
         self._orch_cmd('daemon', 'restart', 'osd.0')