From 12ebb8376e6dfef1c150fb40f6ddef9ae961487b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 4 Dec 2019 11:53:27 +0100 Subject: [PATCH 1/2] ceph: revert "ceph: add the missing newline in lvm.conf's filter configuration line" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit eb908e8959261640b445133cbed9fe5d201cfa93. See next commit for the reason of the revert. Signed-off-by: Sébastien Han --- pkg/daemon/ceph/osd/volume.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/daemon/ceph/osd/volume.go b/pkg/daemon/ceph/osd/volume.go index 6ee3d4531..9649b23a3 100644 --- a/pkg/daemon/ceph/osd/volume.go +++ b/pkg/daemon/ceph/osd/volume.go @@ -154,7 +154,7 @@ func updateLVMConfig(context *clusterd.Context, onPVC bool) error { // When running on PVC if onPVC { output = bytes.Replace(output, []byte(`scan = [ "/dev" ]`), []byte(`scan = [ "/dev", "/mnt" ]`), 1) - output = append(output, []byte(lvmFilter+"\n")...) + output = append(output, []byte(lvmFilter)...) } if err = ioutil.WriteFile(lvmConfPath, output, 0644); err != nil { From ad18158f81a1a9fcf14be3aeeac5783b7e885a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 4 Dec 2019 12:01:01 +0100 Subject: [PATCH 2/2] ceph: revert "ceph: osd append instead of replace" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 75533182352f41368363b66e9fbc55765db40f9b. The append puts the filter at the end of the file and it's out of any lvm section, so it does not work anymore. LVM complains with: Configuration setting "filter" invalid. It's not part of any section. Signed-off-by: Sébastien Han --- pkg/daemon/ceph/osd/volume.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/daemon/ceph/osd/volume.go b/pkg/daemon/ceph/osd/volume.go index 9649b23a3..6fe201b7b 100644 --- a/pkg/daemon/ceph/osd/volume.go +++ b/pkg/daemon/ceph/osd/volume.go @@ -49,7 +49,6 @@ const ( dbDeviceFlag = "--db-devices" cephVolumeCmd = "ceph-volume" cephVolumeMinDBSize = 1024 // 1GB - lvmFilter = `filter = [ "a|^/mnt/.*|", "r|.*|" ]` ) func (a *OsdAgent) configureCVDevices(context *clusterd.Context, devices *DeviceOsdMapping) ([]oposd.OSDInfo, error) { @@ -154,7 +153,13 @@ func updateLVMConfig(context *clusterd.Context, onPVC bool) error { // When running on PVC if onPVC { output = bytes.Replace(output, []byte(`scan = [ "/dev" ]`), []byte(`scan = [ "/dev", "/mnt" ]`), 1) - output = append(output, []byte(lvmFilter)...) + // Only filter blocks in /mnt, when running on PVC we copy the PVC claim path to /mnt + // And reject everything else + // We have 2 different regex depending on the version of LVM present in the container... + // Since https://github.com/lvmteam/lvm2/commit/08396b4bce45fb8311979250623f04ec0ddb628c#diff-13c602a6258e57ce666a240e67c44f38 + // the content changed, so depending which version is installled one of the two replace will work + output = bytes.Replace(output, []byte(`# filter = [ "a|.*/|" ]`), []byte(`filter = [ "a|^/mnt/.*|", "r|.*|" ]`), 1) + output = bytes.Replace(output, []byte(`# filter = [ "a|.*|" ]`), []byte(`filter = [ "a|^/mnt/.*|", "r|.*|" ]`), 1) } if err = ioutil.WriteFile(lvmConfPath, output, 0644); err != nil {