Skip to content

mgr/orch: allow MDS with explicit naming#35142

Merged
sebastian-philipp merged 4 commits intoceph:masterfrom
mgfritch:cephadm-validate-mds-fsname
May 25, 2020
Merged

mgr/orch: allow MDS with explicit naming#35142
sebastian-philipp merged 4 commits intoceph:masterfrom
mgfritch:cephadm-validate-mds-fsname

Conversation

@mgfritch
Copy link
Contributor

Explicitly naming an mds:

ceph orch apply mds a --placement '1;host1=a'

Breaks the ls command:

$ ceph orch ls 
Error ENOENT: DaemonDescription: Cannot calculate service_id: daemon_id='a' hostname='host1'

Fixes: https://tracker.ceph.com/issues/45617
Signed-off-by: Michael Fritch mfritch@suse.com

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

sebastian-philipp and others added 3 commits May 19, 2020 18:59
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Fixes: https://tracker.ceph.com/issues/45617
Signed-off-by: Michael Fritch <mfritch@suse.com>
Signed-off-by: Michael Fritch <mfritch@suse.com>
@mgfritch mgfritch requested a review from a team as a code owner May 20, 2020 01:27
@mgfritch mgfritch mentioned this pull request May 20, 2020
3 tasks
@sebastian-philipp
Copy link
Contributor

can you add this as well?

diff --git a/src/pybind/mgr/cephadm/__init__.py b/src/pybind/mgr/cephadm/__init__.py
index f390f18c16..9a9f074321 100644
--- a/src/pybind/mgr/cephadm/__init__.py
+++ b/src/pybind/mgr/cephadm/__init__.py
@@ -2,5 +2,6 @@ import os
 
 if 'UNITTEST' in os.environ:
     import tests
+    tests.mock_ceph_modules()  # type: ignore
 
 from .module import CephadmOrchestrator
diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py
index 8287fbe6b7..3144c50191 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:
 from execnet.gateway_bootstrap import HostNotFound
 
 from ceph.deployment.service_spec import ServiceSpec, PlacementSpec, RGWSpec, \
-    NFSServiceSpec, IscsiServiceSpec
+    NFSServiceSpec, IscsiServiceSpec, HostPlacementSpec
 from ceph.deployment.drive_selection.selector import DriveSelection
 from ceph.deployment.inventory import Devices, Device
 from orchestrator import ServiceDescription, DaemonDescription, InventoryHost, \
@@ -456,18 +456,36 @@ class TestCephadm(object):
             (ServiceSpec('rbd-mirror'), CephadmOrchestrator.apply_rbd_mirror),
             (ServiceSpec('mds', service_id='fsname'), CephadmOrchestrator.apply_mds),
             (RGWSpec(rgw_realm='realm', rgw_zone='zone'), CephadmOrchestrator.apply_rgw),
+            (RGWSpec(
+                rgw_realm='realm', rgw_zone='zone',
+                placement=PlacementSpec(
+                    hosts=[HostPlacementSpec(
+                        hostname='test',
+                        name='realm.zone.a',
+                        network=''
+                    )]
+                )
+            ), CephadmOrchestrator.apply_rgw),
             (NFSServiceSpec('name', pool='pool', namespace='namespace'), CephadmOrchestrator.apply_nfs),
             (IscsiServiceSpec('name', pool='pool'), CephadmOrchestrator.apply_iscsi),
         ]
     )
     @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}'))
-    def test_apply_save(self, spec: ServiceSpec, meth, cephadm_module):
+    def test_apply_save(self, spec: ServiceSpec, meth, cephadm_module: CephadmOrchestrator):
         with self._with_host(cephadm_module, 'test'):
-            spec.placement = PlacementSpec(hosts=['test'], count=1)
+            if not spec.placement:
+                spec.placement = PlacementSpec(hosts=['test'], count=1)
             c = meth(cephadm_module, spec)
             assert wait(cephadm_module, c) == f'Scheduled {spec.service_name()} update...'
             assert [d.spec for d in wait(cephadm_module, cephadm_module.describe_service())] == [spec]
 
+            cephadm_module._apply_all_services()
+
+            dds = wait(cephadm_module, cephadm_module.list_daemons())
+            for dd in dds:
+                assert dd.service_name() == spec.service_name()
+
+
             assert_rm_service(cephadm_module, spec.service_name())
 
 
diff --git a/src/pybind/mgr/tests/__init__.py b/src/pybind/mgr/tests/__init__.py
index fb6d69e011..7bccfc7997 100644
--- a/src/pybind/mgr/tests/__init__.py
+++ b/src/pybind/mgr/tests/__init__.py
@@ -54,6 +54,8 @@ if 'UNITTEST' in os.environ:
             self._ceph_get_version = mock.Mock()
             self._ceph_get = mock.MagicMock()
             self._ceph_get_option = mock.MagicMock()
+            self._ceph_get_context = mock.MagicMock()
+            self._ceph_register_client = mock.MagicMock()
             self._configure_logging = lambda *_: None
             self._unconfigure_logging = mock.MagicMock()
             self._ceph_log = mock.MagicMock()

Signed-off-by: Michael Fritch <mfritch@suse.com>
@mgfritch
Copy link
Contributor Author

can you add this as well?

also added an MDS test to the applied diff

@mgfritch
Copy link
Contributor Author

@sebastian-philipp sebastian-philipp merged commit 1f33713 into ceph:master May 25, 2020
@mgfritch mgfritch deleted the cephadm-validate-mds-fsname branch May 28, 2020 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants