From: Redouane Kachach Date: Mon, 7 Mar 2022 16:03:08 +0000 (+0100) Subject: mgr/cephadm: fixing MDSSpec ctr X-Git-Tag: v16.2.8~114^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=413f6f4f762507c90128acbd3f9e9e9bd9edfce0;p=ceph.git mgr/cephadm: fixing MDSSpec ctr Fixes issue: https://tracker.ceph.com/issues/54487 Signed-off-by: Redouane Kachach (cherry picked from commit eb4e3f2494e8706cbf5f7c60a37dcb13bca0d83f) --- diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index 4d40b161c2c..69d87bdb49d 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -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) diff --git a/src/python-common/ceph/deployment/service_spec.py b/src/python-common/ceph/deployment/service_spec.py index 76132e61ded..8c81531fc22 100644 --- a/src/python-common/ceph/deployment/service_spec.py +++ b/src/python-common/ceph/deployment/service_spec.py @@ -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)