]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fixing MDSSpec ctr
authorRedouane Kachach <rkachach@redhat.com>
Mon, 7 Mar 2022 16:03:08 +0000 (17:03 +0100)
committerRedouane Kachach <rkachach@redhat.com>
Thu, 10 Mar 2022 09:44:44 +0000 (10:44 +0100)
Fixes issue: https://tracker.ceph.com/issues/54487

Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit eb4e3f2494e8706cbf5f7c60a37dcb13bca0d83f)

src/pybind/mgr/cephadm/tests/test_cephadm.py
src/python-common/ceph/deployment/service_spec.py

index 4d40b161c2c9053c931dac897f74edebc6633b6a..69d87bdb49d5e44301296014a6db574530a16df1 100644 (file)
@@ -16,7 +16,7 @@ except ImportError:
 from execnet.gateway_bootstrap import HostNotFound
 
 from ceph.deployment.service_spec import ServiceSpec, PlacementSpec, RGWSpec, \
-    NFSServiceSpec, IscsiServiceSpec, HostPlacementSpec, CustomContainerSpec
+    NFSServiceSpec, IscsiServiceSpec, HostPlacementSpec, CustomContainerSpec, MDSSpec
 from ceph.deployment.drive_selection.selector import DriveSelection
 from ceph.deployment.inventory import Devices, Device
 from ceph.utils import datetime_to_str, datetime_now
@@ -164,8 +164,8 @@ class TestCephadm(object):
         with with_host(cephadm_module, 'test'):
             c = cephadm_module.list_daemons(refresh=True)
             assert wait(cephadm_module, c) == []
-            with with_service(cephadm_module, ServiceSpec('mds', 'name', unmanaged=True)) as _, \
-                    with_daemon(cephadm_module, ServiceSpec('mds', 'name'), 'test') as _:
+            with with_service(cephadm_module, MDSSpec('mds', 'name', unmanaged=True)) as _, \
+                    with_daemon(cephadm_module, MDSSpec('mds', 'name'), 'test') as _:
 
                 c = cephadm_module.list_daemons()
 
@@ -226,7 +226,7 @@ class TestCephadm(object):
             with with_host(cephadm_module, 'host2'):
                 with with_service(cephadm_module, ServiceSpec('mgr', placement=PlacementSpec(count=2)),
                                   CephadmOrchestrator.apply_mgr, '', status_running=True):
-                    with with_service(cephadm_module, ServiceSpec('mds', 'test-id', placement=PlacementSpec(count=2)),
+                    with with_service(cephadm_module, MDSSpec('mds', 'test-id', placement=PlacementSpec(count=2)),
                                       CephadmOrchestrator.apply_mds, '', status_running=True):
 
                         # with no service-type. Should provide info fot both services
@@ -1289,7 +1289,7 @@ class TestCephadm(object):
     @mock.patch("cephadm.serve.CephadmServe._deploy_cephadm_binary", _deploy_cephadm_binary('test'))
     @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
     def test_mds_config_purge(self, cephadm_module: CephadmOrchestrator):
-        spec = ServiceSpec('mds', service_id='fsname')
+        spec = MDSSpec('mds', service_id='fsname', config={'test': 'foo'})
         with with_host(cephadm_module, 'test'):
             with with_service(cephadm_module, spec, host='test'):
                 ret, out, err = cephadm_module.check_mon_command({
@@ -1308,10 +1308,11 @@ class TestCephadm(object):
     @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
     @mock.patch("cephadm.services.cephadmservice.CephadmService.ok_to_stop")
     def test_daemon_ok_to_stop(self, ok_to_stop, cephadm_module: CephadmOrchestrator):
-        spec = ServiceSpec(
+        spec = MDSSpec(
             'mds',
             service_id='fsname',
-            placement=PlacementSpec(hosts=['host1', 'host2'])
+            placement=PlacementSpec(hosts=['host1', 'host2']),
+            config={'test': 'foo'}
         )
         with with_host(cephadm_module, 'host1'), with_host(cephadm_module, 'host2'):
             c = cephadm_module.apply_mds(spec)
index 76132e61ded4ef18732a9ddc7426bedad437e576..8c81531fc221c7cf919c3105c70177dcf7855729 100644 (file)
@@ -1321,12 +1321,14 @@ class MDSSpec(ServiceSpec):
                  service_type: str = 'mds',
                  service_id: Optional[str] = None,
                  placement: Optional[PlacementSpec] = None,
+                 config: Optional[Dict[str, str]] = None,
                  unmanaged: bool = False,
                  preview_only: bool = False,
                  ):
         assert service_type == 'mds'
         super(MDSSpec, self).__init__('mds', service_id=service_id,
                                       placement=placement,
+                                      config=config,
                                       unmanaged=unmanaged,
                                       preview_only=preview_only)