diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index afe2c2e3447..e0669ecf10e 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -15,7 +15,7 @@ except ImportError: pass 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 @@ -165,8 +165,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() @@ -227,7 +227,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 @@ -1291,7 +1291,7 @@ class TestCephadm(object): @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({ @@ -1310,10 +1310,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) diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index eed17357907..06b0d750c76 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -1321,6 +1321,7 @@ 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, extra_container_args: Optional[List[str]] = None, @@ -1328,6 +1329,7 @@ class MDSSpec(ServiceSpec): assert service_type == 'mds' super(MDSSpec, self).__init__('mds', service_id=service_id, placement=placement, + config=config, unmanaged=unmanaged, preview_only=preview_only, extra_container_args=extra_container_args)