]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: apply_drivegroups() returns a single Completion
authorSebastian Wagner <sebastian.wagner@suse.com>
Tue, 17 Mar 2020 10:52:54 +0000 (11:52 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Wed, 18 Mar 2020 10:03:20 +0000 (11:03 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/tests/test_cephadm.py
src/pybind/mgr/orchestrator/_interface.py
src/pybind/mgr/orchestrator/module.py
src/pybind/mgr/test_orchestrator/module.py

index 63766ee432c88acebfee5d257e64c0c6affecbd3..c32d8f1cee2779a6c3654325c9d618c31282aa47 100644 (file)
@@ -125,8 +125,8 @@ class TestCephadm(object):
             spec = ServiceSpec.from_json(json_spec)
             assert isinstance(spec, DriveGroupSpec)
             c = cephadm_module.apply_drivegroups([spec])
+            assert wait(cephadm_module, c) == ['Scheduled osd update...']
             _save_spec.assert_called_with(spec)
-            assert wait(cephadm_module, c[0]) == 'Scheduled osd update...'
 
     @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}'))
     @mock.patch("cephadm.module.SpecStore.save")
@@ -136,8 +136,8 @@ class TestCephadm(object):
             spec = ServiceSpec.from_json(json_spec)
             assert isinstance(spec, DriveGroupSpec)
             c = cephadm_module.apply_drivegroups([spec])
+            assert wait(cephadm_module, c) == ['Scheduled osd update...']
             _save_spec.assert_called_with(spec)
-            assert wait(cephadm_module, c[0]) == 'Scheduled osd update...'
 
     @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}'))
     def test_create_osds(self, cephadm_module):
index 5331fdb9780a9f2a3d2b7bbe8ff989ff09411de4..c03753c0dbb93fd022fd3c289bd0f5911cbc8e73 100644 (file)
@@ -913,7 +913,7 @@ class Orchestrator(object):
         """
         raise NotImplementedError()
 
-    def apply_drivegroups(self, specs: List[DriveGroupSpec]) -> Sequence[Completion]:
+    def apply_drivegroups(self, specs: List[DriveGroupSpec]) -> Completion:
         """ Update OSD cluster """
         raise NotImplementedError()
 
index e1355ef375ea3e0d61a36aceefd1cf0aa0bca224..a405cf42cdbd8e9375b34f97ee58f160ef043d69 100644 (file)
@@ -465,11 +465,10 @@ Usage:
                 )
             ]
 
-        completions = self.apply_drivegroups(dg_specs)
-        [self._orchestrator_wait([completion]) for completion in completions]  # type: ignore
-        [raise_if_exception(completion) for completion in completions]  # type: ignore
-        result_strings = [completion.result_str() for completion in completions]
-        return HandleCommandResult(stdout=" ".join(result_strings))
+        completion = self.apply_drivegroups(dg_specs)
+        self._orchestrator_wait([completion])
+        raise_if_exception(completion)
+        return HandleCommandResult(stdout=completion.result_str())
 
     @_cli_write_command(
         'orch daemon add osd',
index 10fa8482e6ba66a8746d90827f104deec7160dfa..1483ca1995bc1cf0c253b04a528162a47f950fd7 100644 (file)
@@ -259,7 +259,7 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator):
         )
 
     def apply_drivegroups(self, specs):
-        # type: (List[DriveGroupSpec]) -> Sequence[TestCompletion]
+        # type: (List[DriveGroupSpec]) -> TestCompletion
         drive_group = specs[0]
         def run(all_hosts):
             # type: (List[orchestrator.HostSpec]) -> None
@@ -267,12 +267,12 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator):
             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(
+        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):