]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/mgr/test_orchestrator_cli: adapt 33922/head
authorSage Weil <sage@redhat.com>
Fri, 13 Mar 2020 19:29:01 +0000 (14:29 -0500)
committerSage Weil <sage@redhat.com>
Sat, 14 Mar 2020 15:18:25 +0000 (10:18 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
qa/tasks/mgr/test_orchestrator_cli.py
src/pybind/mgr/test_orchestrator/module.py

index fcc487a6f9cb0dffb551d21caa12377bb7ce8772..9753e18f67a04224ff23eeda591aeca051797273 100644 (file)
@@ -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]
index edc2b6bcd9769810caf33026905e3f8210f96510..5f22e30ce0d7a50497c1e158c379797bd96785de 100644 (file)
@@ -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)