From: Adam King Date: Thu, 25 Jul 2024 17:35:35 +0000 (-0400) Subject: mgr/orchestrator: require "group" field for nvmeof specs X-Git-Tag: v20.0.0~1240^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6d552d7c777f1160545188dcffa6b685b05ca8a;p=ceph.git mgr/orchestrator: require "group" field for nvmeof specs Signed-off-by: Adam King --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 484c2f39e9c..2bddefabe9a 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1831,6 +1831,7 @@ Usage: @_cli_write_command('orch apply nvmeof') def _apply_nvmeof(self, pool: str, + group: str, placement: Optional[str] = None, unmanaged: bool = False, dry_run: bool = False, @@ -1842,8 +1843,9 @@ Usage: raise OrchestratorValidationError('unrecognized command -i; -h or --help for usage') spec = NvmeofServiceSpec( - service_id=pool, + service_id=f'{pool}.{group}', pool=pool, + group=group, placement=PlacementSpec.from_string(placement), unmanaged=unmanaged, preview_only=dry_run diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index a69b3a25dcd..274ada81d93 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -1381,7 +1381,7 @@ class NvmeofServiceSpec(ServiceSpec): #: ``name`` name of the nvmeof gateway self.name = name #: ``group`` name of the nvmeof gateway - self.group = group or '' + self.group = group #: ``enable_auth`` enables user authentication on nvmeof gateway self.enable_auth = enable_auth #: ``state_update_notify`` enables automatic update from OMAP in nvmeof gateway @@ -1473,6 +1473,9 @@ class NvmeofServiceSpec(ServiceSpec): if not self.pool: raise SpecValidationError('Cannot add NVMEOF: No Pool specified') + if not self.group: + raise SpecValidationError('Cannot add NVMEOF: No group specified') + if self.enable_auth: if not all([self.server_key, self.server_cert, self.client_key, self.client_cert, self.root_ca_cert]):