From 9d42b1ce97a8de4fd6ff52bafe16ed92b3f365cc Mon Sep 17 00:00:00 2001 From: Joshua Schmid Date: Wed, 8 Jan 2020 17:26:59 +0100 Subject: [PATCH] mgr/cephadm: add warning to other orchestrators the extended drivegroup approach is not fully supported with the other orchestrators and probably need to get reworked. Signed-off-by: Joshua Schmid --- src/pybind/mgr/ansible/module.py | 45 +++++++++++++--------- src/pybind/mgr/rook/module.py | 16 +++++++- src/pybind/mgr/test_orchestrator/module.py | 20 +++++++++- 3 files changed, 60 insertions(+), 21 deletions(-) diff --git a/src/pybind/mgr/ansible/module.py b/src/pybind/mgr/ansible/module.py index 1fd9732e15154..aa2c1515b256f 100644 --- a/src/pybind/mgr/ansible/module.py +++ b/src/pybind/mgr/ansible/module.py @@ -353,28 +353,37 @@ class Module(MgrModule, orchestrator.Orchestrator): If no host provided the operation affects all the host in the OSDS role - :param drive_groups: (ceph.deployment.drive_group.DriveGroupSpec), + :param drive_groups: List[(ceph.deployment.drive_group.DriveGroupSpec)], Drive group with the specification of drives to use + + Caveat: Currently limited to a single DriveGroup. + The orchestrator_cli expects a single completion which + ideally represents a set of operations. This orchestrator + doesn't support this notion, yet. Hence it's only accepting + a single DriveGroup for now. + You can work around it by invoking: + + $: ceph orchestrator osd create -i + + multiple times. The drivegroup file must only contain one spec at a time. """ + drive_group = drive_groups[0] # Transform drive group specification to Ansible playbook parameters - ops = [] - for drive_group in drive_groups: - host, osd_spec = dg_2_ansible(drive_group) - - # Create a new read completion object for execute the playbook - op = playbook_operation(client=self.ar_client, - playbook=ADD_OSD_PLAYBOOK, - result_pattern="", - params=osd_spec, - querystr_dict={"limit": host}, - output_wizard=ProcessPlaybookResult(self.ar_client), - event_filter_list=["playbook_on_stats"]) - - self._launch_operation(op) - ops.append(op) - - return ops + host, osd_spec = dg_2_ansible(drive_group) + + # Create a new read completion object for execute the playbook + op = playbook_operation(client=self.ar_client, + playbook=ADD_OSD_PLAYBOOK, + result_pattern="", + params=osd_spec, + querystr_dict={"limit": host}, + output_wizard=ProcessPlaybookResult(self.ar_client), + event_filter_list=["playbook_on_stats"]) + + self._launch_operation(op) + + return op def remove_osds(self, osd_ids, destroy=False): """Remove osd's. diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index f76f6cd5a86cb..098a66e81ba7f 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -369,8 +369,22 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): mgr=self ) - def create_osds(self, drive_group): + def create_osds(self, drive_groups): # type: (List[DriveGroupSpec]) -> RookCompletion + """ Creates OSDs from a drive group specification. + + Caveat: Currently limited to a single DriveGroup. + The orchestrator_cli expects a single completion which + ideally represents a set of operations. This orchestrator + doesn't support this notion, yet. Hence it's only accepting + a single DriveGroup for now. + You can work around it by invoking: + + $: ceph orchestrator osd create -i + + multiple times. The drivegroup file must only contain one spec at a time. + """ + drive_group = drive_groups[0] targets = [] # type: List[str] if drive_group.data_devices: diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index d1c29578573fc..642528aa5fc5c 100644 --- a/src/pybind/mgr/test_orchestrator/module.py +++ b/src/pybind/mgr/test_orchestrator/module.py @@ -13,6 +13,7 @@ except ImportError: import six from ceph.deployment import inventory +from ceph.deployment.drive_group import DriveGroupSpec from mgr_module import CLICommand, HandleCommandResult from mgr_module import MgrModule @@ -183,8 +184,23 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator): return result - def create_osds(self, drive_group): - # type: (orchestrator.DriveGroupSpec) -> TestCompletion + def create_osds(self, drive_groups): + # type: (List[DriveGroupSpec]) -> TestCompletion + """ Creates OSDs from a drive group specification. + + Caveat: Currently limited to a single DriveGroup. + The orchestrator_cli expects a single completion which + ideally represents a set of operations. This orchestrator + doesn't support this notion, yet. Hence it's only accepting + a single DriveGroup for now. + You can work around it by invoking: + + $: ceph orchestrator osd create -i + + multiple times. The drivegroup file must only contain one spec at a time. + """ + drive_group = drive_groups[0] + def run(all_hosts): drive_group.validate(orchestrator.InventoryNode.get_host_names(all_hosts)) return self.get_hosts().then(run).then( -- 2.39.5