]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix lvm activate --all --no-systemd 43267/head
authorDimitri Savineau <dsavinea@redhat.com>
Tue, 24 Aug 2021 21:17:45 +0000 (17:17 -0400)
committerCory Snyder <csnyder@iland.com>
Wed, 22 Sep 2021 18:19:59 +0000 (14:19 -0400)
When using a system without systemd then the `lvm activate --all --no-systemd`
subcommand still calls systemd.
We already allow users to activate a single OSD without systemd so there's
no reason to not do the same with --all (because activate_all calls activate).

Fixes: https://tracker.ceph.com/issues/25070
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 8e402e112a6383555e2df31ba3321e5956f1841a)

src/ceph-volume/ceph_volume/devices/lvm/activate.py
src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py

index c864b0e9f05289eaf3fa64101ae598691ac09c47..70fceeab6457257416b3368044f41c359ec9249d 100644 (file)
@@ -245,7 +245,7 @@ class Activate(object):
             terminal.warning('Verify OSDs are present with "ceph-volume lvm list"')
             return
         for osd_fsid, osd_id in osds.items():
-            if systemctl.osd_is_active(osd_id):
+            if not args.no_systemd and systemctl.osd_is_active(osd_id):
                 terminal.warning(
                     'OSD ID %s FSID %s process is active. Skipping activation' % (osd_id, osd_fsid)
                 )
index 46d7c3c83578e5be9201624deb65bf68405a1117..1fae5c4e0c34c472b1be1a69b283fe1943fb9de6 100644 (file)
@@ -357,7 +357,7 @@ class TestActivateAll(object):
         assert 'a8789a96ce8b process is active. Skipping activation' in err
         assert 'b8218eaa1634 process is active. Skipping activation' in err
 
-    def test_detects_osds_to_activate(self, is_root, capture, monkeypatch):
+    def test_detects_osds_to_activate_systemd(self, is_root, capture, monkeypatch):
         monkeypatch.setattr('ceph_volume.devices.lvm.activate.direct_report', lambda: direct_report)
         monkeypatch.setattr('ceph_volume.devices.lvm.activate.systemctl.osd_is_active', lambda x: False)
         args = ['--all']
@@ -370,6 +370,18 @@ class TestActivateAll(object):
         assert calls[1]['kwargs']['osd_id'] == '1'
         assert calls[1]['kwargs']['osd_fsid'] == 'd0f3e4ad-e52a-4520-afc0-a8789a96ce8b'
 
+    def test_detects_osds_to_activate_no_systemd(self, is_root, capture, monkeypatch):
+        monkeypatch.setattr('ceph_volume.devices.lvm.activate.direct_report', lambda: direct_report)
+        args = ['--all', '--no-systemd']
+        activation = activate.Activate(args)
+        activation.activate = capture
+        activation.main()
+        calls = sorted(capture.calls, key=lambda x: x['kwargs']['osd_id'])
+        assert calls[0]['kwargs']['osd_id'] == '0'
+        assert calls[0]['kwargs']['osd_fsid'] == '957d22b7-24ce-466a-9883-b8218eaa1634'
+        assert calls[1]['kwargs']['osd_id'] == '1'
+        assert calls[1]['kwargs']['osd_fsid'] == 'd0f3e4ad-e52a-4520-afc0-a8789a96ce8b'
+
 #
 # Activate All fixture
 #