From: Tomer Haskalovitch Date: Tue, 24 Feb 2026 11:38:00 +0000 (+0200) Subject: mgr/nvmeof: use nvmeof module during orch nvmeof apply X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f5734cf41b18add5e54efa13c4519359705dae57;p=ceph.git mgr/nvmeof: use nvmeof module during orch nvmeof apply Added a call to create_pool_if_not_exists during the execution of ceph orch apply nvmeof command. Fixes: https://tracker.ceph.com/issues/74702 Signed-off-by: Tomer Haskalovitch --- diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 3a7d453f799..876f1c536d6 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -2117,10 +2117,23 @@ Usage: return self._apply_misc([spec], dry_run, format, no_overwrite) + def _is_module_enabled(self, module: str) -> bool: + mgr_map = self.get('mgr_map') + return ( + module in mgr_map.get('modules', []) + or module in mgr_map.get('always_on_modules', []).get(self.release_name, []) + ) + + def _create_nvmeof_metadata_pool_if_needed(self) -> None: + if not self._is_module_enabled('nvmeof'): + raise OrchestratorError('nvmeof module must be enabled to use .nvmeof pool') + self.remote('nvmeof', 'create_pool_if_not_exists') + @OrchestratorCLICommand.Write('orch apply nvmeof') def _apply_nvmeof(self, - pool: str, - group: str, + _end_positional_: int = 0, + pool: str = ".nvmeof", + group: str = '', placement: Optional[str] = None, unmanaged: bool = False, dry_run: bool = False, @@ -2128,11 +2141,18 @@ Usage: no_overwrite: bool = False, inbuf: Optional[str] = None) -> HandleCommandResult: """Scale an nvmeof service""" + if group == '': + raise OrchestratorValidationError('The --group argument is required') + if inbuf: raise OrchestratorValidationError('unrecognized command -i; -h or --help for usage') + if pool == ".nvmeof": + self._create_nvmeof_metadata_pool_if_needed() + + cleanpool = pool.lstrip('.') spec = NvmeofServiceSpec( - service_id=f'{pool}.{group}' if group else pool, + service_id=f'{cleanpool}.{group}' if group else cleanpool, pool=pool, group=group, placement=PlacementSpec.from_string(placement),