From: Sage Weil Date: Tue, 3 Aug 2021 18:36:39 +0000 (-0400) Subject: mgr/orchestrator: accept --method arg to 'orch daemon add osd' X-Git-Tag: v17.1.0~502^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cef129d90abd73536a141fb375ce35cc7e5081a4;p=ceph.git mgr/orchestrator: accept --method arg to 'orch daemon add osd' Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index dde3397ce60c..b9793f1939c2 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -9,7 +9,7 @@ import yaml from prettytable import PrettyTable from ceph.deployment.inventory import Device -from ceph.deployment.drive_group import DriveGroupSpec, DeviceSelection +from ceph.deployment.drive_group import DriveGroupSpec, DeviceSelection, OSDMethod from ceph.deployment.service_spec import PlacementSpec, ServiceSpec from ceph.deployment.hostspec import SpecValidationError from ceph.utils import datetime_now @@ -794,7 +794,9 @@ Examples: return HandleCommandResult(-errno.EINVAL, stderr=usage) @_cli_write_command('orch daemon add osd') - def _daemon_add_osd(self, svc_arg: Optional[str] = None) -> HandleCommandResult: + def _daemon_add_osd(self, + svc_arg: Optional[str] = None, + method: Optional[OSDMethod] = None) -> HandleCommandResult: """Create an OSD service. Either --svc_arg=host:drives""" # Create one or more OSDs""" @@ -808,10 +810,13 @@ Usage: host_name, block_device = svc_arg.split(":") block_devices = block_device.split(',') devs = DeviceSelection(paths=block_devices) - drive_group = DriveGroupSpec(placement=PlacementSpec( - host_pattern=host_name), data_devices=devs) - except (TypeError, KeyError, ValueError): - msg = "Invalid host:device spec: '{}'".format(svc_arg) + usage + drive_group = DriveGroupSpec( + placement=PlacementSpec(host_pattern=host_name), + data_devices=devs, + method=method, + ) + except (TypeError, KeyError, ValueError) as e: + msg = f"Invalid host:device spec: '{svc_arg}': {e}" + usage return HandleCommandResult(-errno.EINVAL, stderr=msg) completion = self.create_osds(drive_group)