Merge pull request #4424 from leseb/lvm-filter-again

ceph: lvm filter again
This commit is contained in:
Sébastien Han authored and GitHub committed 2019-12-04 21:13:32 +01:00
commit c5e79d4876
1 file changed
+7 -2
+7 -2
View File
@@ -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+"\n")...)
// 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 {