From: Sage Weil Date: Fri, 13 Mar 2020 19:29:01 +0000 (-0500) Subject: qa/tasks/mgr/test_orchestrator_cli: adapt X-Git-Tag: v15.2.0~50^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=279cfb551fe77118069d2c7cc5a5afad023430ea;p=ceph-ci.git qa/tasks/mgr/test_orchestrator_cli: adapt Signed-off-by: Sage Weil --- diff --git a/qa/tasks/mgr/test_orchestrator_cli.py b/qa/tasks/mgr/test_orchestrator_cli.py index fcc487a6f9c..9753e18f67a 100644 --- a/qa/tasks/mgr/test_orchestrator_cli.py +++ b/qa/tasks/mgr/test_orchestrator_cli.py @@ -82,22 +82,18 @@ class TestOrchestratorCli(MgrTestCase): self._orch_cmd("daemon", "start", "mds.a") def test_osd_create(self): - self._orch_cmd("osd", "create", "*:device") - self._orch_cmd("osd", "create", "*:device,device2") - - drive_groups = { - 'test': { - "host_pattern": "*", - "data_devices": {"paths": ["/dev/sda"]} - } - } - - res = self._orch_cmd_result("osd", "create", "-i", "-", stdin=json.dumps(drive_groups)) + drive_group = """ +service_type: osd +service_id: any.sda +placement: + host_pattern: '*' +data_devices: + all: True +""" + res = self._orch_cmd_result("apply", "osd", "-i", "-", + stdin=drive_group) self.assertEqual(res, 0) - with self.assertRaises(Exception): - self._orch_cmd("osd", "create", "notfound:device") - def test_blink_device_light(self): def _ls_lights(what): return json.loads(self._cmd("device", "ls-lights"))[what] diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index edc2b6bcd97..5f22e30ce0d 100644 --- a/src/pybind/mgr/test_orchestrator/module.py +++ b/src/pybind/mgr/test_orchestrator/module.py @@ -258,6 +258,22 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator): ) ) + def apply_drivegroups(self, specs): + # type: (List[DriveGroupSpec]) -> TestCompletion + drive_group = specs[0] + def run(all_hosts): + # type: (List[orchestrator.HostSpec]) -> None + drive_group.validate() + if drive_group.placement.host_pattern: + if not drive_group.placement.pattern_matches_hosts([h.hostname for h in all_hosts]): + raise orchestrator.OrchestratorValidationError('failed to match') + return self.get_hosts().then(run).then( + on_complete=orchestrator.ProgressReference( + message='apply_drivesgroups', + mgr=self, + ) + ) + @deferred_write("remove_daemons") def remove_daemons(self, names, force): assert isinstance(names, list)