diff options
author | Adam King <47704447+adk3798@users.noreply.github.com> | 2024-08-23 14:54:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 14:54:21 +0200 |
commit | 3c92a0b59cc9efc82b0704eb91cd7ffa0c21e5d9 (patch) | |
tree | 17f7fd96d6b32c68a0a789370440ae061d2a761f /src/pybind/mgr/orchestrator | |
parent | Merge PR #56602 into main (diff) | |
parent | mgr/orchestrator: fix encrypted flag handling in orch daemon add osd (diff) | |
download | ceph-3c92a0b59cc9efc82b0704eb91cd7ffa0c21e5d9.tar.xz ceph-3c92a0b59cc9efc82b0704eb91cd7ffa0c21e5d9.zip |
Merge pull request #59175 from Yonatan-Zaken/fix_boolean_flags_handling_for_ceph_orch_daemon_add_osd
mgr/orchestrator: fix encrypted flag handling in orch daemon add osd
Reviewed-by: Adam King <adking@redhat.com>
Reviewed-by: Guillaume Abrioux <gabrioux@ibm.com>
Diffstat (limited to 'src/pybind/mgr/orchestrator')
-rw-r--r-- | src/pybind/mgr/orchestrator/module.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 32c379492ea..d0f3286177c 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1337,7 +1337,8 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, usage = """ Usage: ceph orch daemon add osd host:device1,device2,... - ceph orch daemon add osd host:data_devices=device1,device2,db_devices=device3,osds_per_device=2,... + ceph orch daemon add osd host:data_devices=device1,device2,db_devices=device3,osds_per_device=2[,encrypted=true|True|1] + ceph orch daemon add osd host:data_devices=device1[,encrypted=false|False|0] """ if not svc_arg: return HandleCommandResult(-errno.EINVAL, stderr=usage) @@ -1370,6 +1371,16 @@ Usage: drive_group_spec[dev_type] = DeviceSelection( paths=drive_group_spec[dev_type]) if drive_group_spec.get(dev_type) else None + valid_true_vals = {'true', '1'} + valid_false_vals = {'false', '0'} + for drive_group_spec_bool_arg in ['encrypted', 'unmanaged', 'preview_only']: + drive_group_spec_value: Optional[str] = drive_group_spec.get(drive_group_spec_bool_arg) + if isinstance(drive_group_spec_value, str): + value_lower = drive_group_spec_value.lower() + if value_lower not in valid_true_vals and value_lower not in valid_false_vals: + raise OrchestratorValidationError(usage) + drive_group_spec[drive_group_spec_bool_arg] = value_lower in valid_true_vals + drive_group = DriveGroupSpec( placement=PlacementSpec(host_pattern=host_name), method=method, |