48 lines
2.9 KiB
Diff
48 lines
2.9 KiB
Diff
Link: https://github.com/ceph/ceph/commit/667d43ce2aebe919e4d1beb495d7cfd1ac330dd6
|
|
Subject: ceph-volume: fix lvm activate --all --no-systemd
|
|
Bug: 125191
|
|
Tags: common
|
|
|
|
diff -rupN a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py
|
|
--- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py 2021-09-10 15:44:06.453006249 +0300
|
|
+++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py 2021-09-10 15:45:54.806470103 +0300
|
|
@@ -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)
|
|
)
|
|
diff -rupN a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py
|
|
--- a/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py 2021-09-10 15:45:02.809203967 +0300
|
|
+++ b/src/ceph-volume/ceph_volume/tests/devices/lvm/test_activate.py 2021-09-10 15:47:26.094116216 +0300
|
|
@@ -345,13 +345,25 @@ 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']
|
|
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'
|
|
+
|
|
+ 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'
|