Skip to content

Commit 3c92a0b

Browse files
authored
Merge pull request ceph#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 <[email protected]> Reviewed-by: Guillaume Abrioux <[email protected]>
2 parents 1606e7f + 42721c0 commit 3c92a0b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/pybind/mgr/orchestrator/module.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,8 @@ def _daemon_add_osd(self,
13371337
usage = """
13381338
Usage:
13391339
ceph orch daemon add osd host:device1,device2,...
1340-
ceph orch daemon add osd host:data_devices=device1,device2,db_devices=device3,osds_per_device=2,...
1340+
ceph orch daemon add osd host:data_devices=device1,device2,db_devices=device3,osds_per_device=2[,encrypted=true|True|1]
1341+
ceph orch daemon add osd host:data_devices=device1[,encrypted=false|False|0]
13411342
"""
13421343
if not svc_arg:
13431344
return HandleCommandResult(-errno.EINVAL, stderr=usage)
@@ -1370,6 +1371,16 @@ def _daemon_add_osd(self,
13701371
drive_group_spec[dev_type] = DeviceSelection(
13711372
paths=drive_group_spec[dev_type]) if drive_group_spec.get(dev_type) else None
13721373

1374+
valid_true_vals = {'true', '1'}
1375+
valid_false_vals = {'false', '0'}
1376+
for drive_group_spec_bool_arg in ['encrypted', 'unmanaged', 'preview_only']:
1377+
drive_group_spec_value: Optional[str] = drive_group_spec.get(drive_group_spec_bool_arg)
1378+
if isinstance(drive_group_spec_value, str):
1379+
value_lower = drive_group_spec_value.lower()
1380+
if value_lower not in valid_true_vals and value_lower not in valid_false_vals:
1381+
raise OrchestratorValidationError(usage)
1382+
drive_group_spec[drive_group_spec_bool_arg] = value_lower in valid_true_vals
1383+
13731384
drive_group = DriveGroupSpec(
13741385
placement=PlacementSpec(host_pattern=host_name),
13751386
method=method,

0 commit comments

Comments
 (0)