From 8bb3721a1d0754f64069d078ad71e7bb56c784ff Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 3 May 2021 11:48:45 -0400 Subject: [PATCH] mgr/orchestrator: default nfs pool, namespaces Apply nfs default pool (currently 'nfs-ganesha'), and default the namespace to the service_id. There is no practical reason for users to ever need to change this, and requiring them to provide this informaiton at config/apply time just complicates life. Signed-off-by: Sage Weil (cherry picked from commit 09be2e14cc8d1d06609e876b6f0b0a579c11cd58) --- src/pybind/mgr/orchestrator/module.py | 4 ++-- src/python-common/ceph/deployment/service_spec.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 1b36ac923d528..8658f4bb6d98b 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1121,10 +1121,10 @@ Usage: @_cli_write_command('orch apply nfs') def _apply_nfs(self, svc_id: str, - pool: str, - namespace: Optional[str] = None, placement: Optional[str] = None, format: Format = Format.plain, + pool: Optional[str] = None, + namespace: Optional[str] = None, port: Optional[int] = None, dry_run: bool = False, unmanaged: bool = False, diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index dd77c838a54ad..c9429bbbf2cdd 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -660,16 +660,18 @@ yaml.add_representer(ServiceSpec, ServiceSpec.yaml_representer) class NFSServiceSpec(ServiceSpec): + DEFAULT_POOL = 'nfs-ganesha' + def __init__(self, service_type: str = 'nfs', service_id: Optional[str] = None, - pool: Optional[str] = None, - namespace: Optional[str] = None, placement: Optional[PlacementSpec] = None, unmanaged: bool = False, preview_only: bool = False, config: Optional[Dict[str, str]] = None, networks: Optional[List[str]] = None, + pool: Optional[str] = None, + namespace: Optional[str] = None, port: Optional[int] = None, ): assert service_type == 'nfs' @@ -679,10 +681,10 @@ class NFSServiceSpec(ServiceSpec): config=config, networks=networks) #: RADOS pool where NFS client recovery data is stored. - self.pool = pool + self.pool = pool or self.DEFAULT_POOL #: RADOS namespace where NFS client recovery data is stored in the pool. - self.namespace = namespace + self.namespace = namespace or self.service_id self.port = port -- 2.39.5