]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: change nfs pool to .nfs
authorSage Weil <sage@newdream.net>
Fri, 2 Jul 2021 16:39:29 +0000 (12:39 -0400)
committerSage Weil <sage@newdream.net>
Wed, 14 Jul 2021 20:20:11 +0000 (16:20 -0400)
This is a new pool that we can migrate all past NFS configuration to,
simplifying the migration process (and also allowing us to pick a
.-prefixed name).

Signed-off-by: Sage Weil <sage@newdream.net>
qa/tasks/cephfs/test_nfs.py
src/pybind/mgr/cephadm/services/nfs.py
src/pybind/mgr/mgr_module.py
src/pybind/mgr/nfs/cluster.py
src/pybind/mgr/nfs/export.py
src/pybind/mgr/nfs/tests/test_nfs.py
src/pybind/mgr/nfs/utils.py
src/pybind/mgr/rook/rook_cluster.py
src/python-common/ceph/deployment/service_spec.py

index 3013dffe1e540b6f3869baee9481c7092320436e..dae3e9f9d6cffc40494e618c4c5080201cb13773 100644 (file)
@@ -161,7 +161,7 @@ class TestNFS(MgrTestCase):
         self._cmd(*export_cmd)
         # Check if user id for export is created
         self._check_auth_ls(export_id, check_in=True)
-        res = self._sys_cmd(['rados', '-p', 'nfs-ganesha', '-N', self.cluster_id, 'get',
+        res = self._sys_cmd(['rados', '-p', '.nfs', '-N', self.cluster_id, 'get',
                              f'export-{export_id}', '-'])
         # Check if export object is created
         if res == b'':
@@ -233,7 +233,7 @@ class TestNFS(MgrTestCase):
         Test if export or config object are deleted successfully.
         :param conf_obj: It denotes config object needs to be checked
         '''
-        rados_obj_ls = self._sys_cmd(['rados', '-p', 'nfs-ganesha', '-N', self.cluster_id, 'ls'])
+        rados_obj_ls = self._sys_cmd(['rados', '-p', '.nfs', '-N', self.cluster_id, 'ls'])
 
         if b'export-' in rados_obj_ls or (conf_obj and b'conf-nfs' in rados_obj_ls):
             self.fail("Delete export failed")
@@ -472,7 +472,7 @@ class TestNFS(MgrTestCase):
         '''
         self._test_create_cluster()
 
-        pool = 'nfs-ganesha'
+        pool = '.nfs'
         user_id = 'test'
         fs_name = 'user_test_fs'
         pseudo_path = '/ceph'
@@ -511,7 +511,7 @@ class TestNFS(MgrTestCase):
         self.assertEqual(config, res.decode('utf-8'))
         self._test_mnt(pseudo_path, port, ip)
         self._nfs_cmd('cluster', 'config', 'reset', self.cluster_id)
-        rados_obj_ls = self._sys_cmd(['rados', '-p', 'nfs-ganesha', '-N', self.cluster_id, 'ls'])
+        rados_obj_ls = self._sys_cmd(['rados', '-p', '.nfs', '-N', self.cluster_id, 'ls'])
         if b'conf-nfs' not in rados_obj_ls and b'userconf-nfs' in rados_obj_ls:
             self.fail("User config not deleted")
         time.sleep(30)
index fdd4d7a59d3150b071b01034002123010c575ab5..0bdfe090c218d34043b58ba2d02c9bd869b871de 100644 (file)
@@ -6,6 +6,7 @@ import tempfile
 from typing import Dict, Tuple, Any, List, cast, Optional
 
 from mgr_module import HandleCommandResult
+from mgr_module import NFS_POOL_NAME as POOL_NAME
 
 from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec
 
@@ -13,9 +14,6 @@ from orchestrator import DaemonDescription
 
 from cephadm.services.cephadmservice import AuthEntity, CephadmDaemonDeploySpec, CephService
 
-
-POOL_NAME = 'nfs-ganesha'   # make sure this matches pybind/mgr/nfs/nfs_utils.py
-
 logger = logging.getLogger(__name__)
 
 
index 83d3d59fc00b2379b7722726bcceae73690d03b3..f7da34b771344a15bc07b13a67be7d13a33758b4 100644 (file)
@@ -79,6 +79,8 @@ PG_STATES = [
     "wait",
 ]
 
+NFS_POOL_NAME = '.nfs'
+
 
 class CommandResult(object):
     """
index 4e3c207e2b76c757130b7a28d9dc89cf5b9d1709..6683891162fe32e4d872908cee5324aa5725d391 100644 (file)
@@ -4,12 +4,13 @@ import re
 import socket
 from typing import cast, Dict, List, Any, Union, Optional, TYPE_CHECKING, Tuple
 
+from mgr_module import NFS_POOL_NAME as POOL_NAME
 from ceph.deployment.service_spec import NFSServiceSpec, PlacementSpec, IngressSpec
 
 import orchestrator
 
 from .exception import NFSInvalidOperation, ClusterNotFound
-from .utils import POOL_NAME, available_clusters, restart_nfs_service
+from .utils import available_clusters, restart_nfs_service
 from .export import NFSRados, exception_handler
 
 if TYPE_CHECKING:
index 87d392e4d3716ebf26f8e8253d4fa63b44086158..b61392950cfbed146d321b1432bcb885b66293e9 100644 (file)
@@ -7,10 +7,12 @@ from os.path import normpath
 
 from rados import TimedOut, ObjectNotFound
 
+from mgr_module import NFS_POOL_NAME as POOL_NAME
+
 from .export_utils import GaneshaConfParser, Export, RawBlock, CephFSFSAL, RGWFSAL
 from .exception import NFSException, NFSInvalidOperation, FSNotFound, \
     ClusterNotFound
-from .utils import POOL_NAME, available_clusters, check_fs, restart_nfs_service
+from .utils import available_clusters, check_fs, restart_nfs_service
 
 if TYPE_CHECKING:
     from nfs.module import Module
index 3e1911d727975c9d56225e71a36d123c428fc433..c21139e4fbab93188feaa8cb6b0d5253df7c1704 100644 (file)
@@ -83,13 +83,13 @@ EXPORT
     conf_nodeb = '%url "rados://ganesha/ns/export-1"'
 
     conf_nfs_foo = '''
-%url "rados://nfs-ganesha/foo/export-1"
+%url "rados://.nfs/foo/export-1"
 
-%url "rados://nfs-ganesha/foo/export-2"'''
+%url "rados://.nfs/foo/export-2"'''
 
     clusters = {
         'foo': {
-            'pool': 'nfs-ganesha',
+            'pool': '.nfs',
             'namespace': 'foo',
             'type': "ORCHESTRATOR",
             'daemon_conf': 'conf-nfs.foo',
@@ -166,9 +166,7 @@ EXPORT
         # mock nfs services
         cluster_info = self.clusters['foo']
         orch_nfs_services = [
-            ServiceDescription(spec=NFSServiceSpec(service_id='foo',
-                                                   pool=cluster_info['pool'],
-                                                   namespace=cluster_info['namespace']))
+            ServiceDescription(spec=NFSServiceSpec(service_id='foo'))
         ] if enable else []
 
         """
@@ -271,17 +269,17 @@ EXPORT
                 "minor_versions": [1, 2]
             }),
             RawBlock('RADOS_KV', values={
-                "pool": "nfs-ganesha",
+                "pool": ".nfs",
                 "namespace": "vstart",
                 "userid": "vstart",
                 "nodeid": "a"
             }),
             RawBlock('RADOS_URLS', values={
                 "userid": "vstart",
-                "watch_url": "'rados://nfs-ganesha/vstart/conf-nfs.vstart'"
+                "watch_url": "'rados://.nfs/vstart/conf-nfs.vstart'"
             }),
             RawBlock('%url', values={
-                "value": "rados://nfs-ganesha/vstart/conf-nfs.vstart"
+                "value": "rados://.nfs/vstart/conf-nfs.vstart"
             })
         ]
         daemon_raw_config = """
@@ -302,7 +300,7 @@ NFS_CORE_PARAM {
         }
 
         RADOS_KV {
-           pool = nfs-ganesha;
+           pool = .nfs;
            namespace = vstart;
            UserId = vstart;
            nodeid = a;
@@ -310,10 +308,10 @@ NFS_CORE_PARAM {
 
         RADOS_URLS {
        Userid = vstart;
-       watch_url = 'rados://nfs-ganesha/vstart/conf-nfs.vstart';
+       watch_url = 'rados://.nfs/vstart/conf-nfs.vstart';
         }
 
-    %url rados://nfs-ganesha/vstart/conf-nfs.vstart
+    %url rados://.nfs/vstart/conf-nfs.vstart
 """
         daemon_config = GaneshaConfParser(daemon_raw_config).parse()
         assert daemon_config == expected_daemon_config
index da7ca690b82e2e9243528f744ee2f12e273c260c..00552dfc0de12c18f4e987047d187027b602d0af 100644 (file)
@@ -5,8 +5,6 @@ import orchestrator
 if TYPE_CHECKING:
     from nfs.module import Module
 
-POOL_NAME = 'nfs-ganesha'
-
 
 def available_clusters(mgr: 'Module') -> List[str]:
     '''
index 49742369f7a8814c0b62d788b6bf9d1799fad352..daefe7a739468daeca338a511ea9c170160f58e1 100644 (file)
@@ -23,6 +23,7 @@ from urllib3.exceptions import ProtocolError
 from ceph.deployment.drive_group import DriveGroupSpec
 from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, RGWSpec
 from ceph.utils import datetime_now
+from mgr_module import NFS_POOL_NAME
 from mgr_util import merge_dicts
 
 from typing import Optional, TypeVar, List, Callable, Any, cast, Generic, \
@@ -41,18 +42,14 @@ from .rook_client.ceph import cephobjectstore as cos
 from .rook_client.ceph import cephcluster as ccl
 from .rook_client._helper import CrdClass
 
-
 import orchestrator
 
-
 try:
     from rook.module import RookEnv
 except ImportError:
     pass  # just used for type checking.
 
 
-POOL_NAME = 'nfs-ganesha'   # keep in sync with mgr/nfs/nfs_utils.py
-
 T = TypeVar('T')
 FuncT = TypeVar('FuncT', bound=Callable)
 
@@ -504,7 +501,7 @@ class RookCluster(object):
                     spec=cnfs.Spec(
                         rados=cnfs.Rados(
                             namespace=self.rook_env.namespace,
-                            pool=POOL_NAME,
+                            pool=NFS_POOL_NAME,
                             ),
                         server=cnfs.Server(
                             active=count
index faa8674c11032585bd5c946c3fb16a54a5baf498..8af990431da17fad7274bb3e13f0f025ca9f8ef3 100644 (file)
@@ -663,7 +663,7 @@ yaml.add_representer(ServiceSpec, ServiceSpec.yaml_representer)
 
 
 class NFSServiceSpec(ServiceSpec):
-    DEFAULT_POOL = 'nfs-ganesha'
+    DEFAULT_POOL = '.nfs'
 
     def __init__(self,
                  service_type: str = 'nfs',