diff options
author | Yonatan Zaken <yonatan.zaken@gmail.com> | 2024-08-12 22:00:39 +0200 |
---|---|---|
committer | Yonatan Zaken <yonatan.zaken@gmail.com> | 2024-08-14 00:56:58 +0200 |
commit | 42721c03ee6f2c47a20dfb4d40af4f7f7afe6113 (patch) | |
tree | 90524fa8bfeca16a1ebb86965ef81f24cb12f5ce /src/pybind/mgr/orchestrator/module.py | |
parent | Merge pull request #58140 from guits/cv-tpm2-support (diff) | |
download | ceph-42721c03ee6f2c47a20dfb4d40af4f7f7afe6113.tar.xz ceph-42721c03ee6f2c47a20dfb4d40af4f7f7afe6113.zip |
mgr/orchestrator: fix encrypted flag handling in orch daemon add osd
The current implementation incorrectly parses this `encrypted` flag as a string rather than a boolean value.
This leads to unintended behavior causing an LVM encryption layer to be created regardless of whether `encrypted=True` or `encrypted=False` is passed.
The only way to prevent this behavior is by omitting the `encrypted` flag entirely.
This change prevents potential errors, aligning the behavior with user expectations.
Fixes: https://tracker.ceph.com/issues/67372
Signed-off-by: Yonatan Zaken <yonatan.zaken@gmail.com>
Diffstat (limited to 'src/pybind/mgr/orchestrator/module.py')
-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 484c2f39e9c..aa5b1106d9d 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1336,7 +1336,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) @@ -1369,6 +1370,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, |