Blob Blame History Raw
From a977e8389a09615615dc76dee8aaaea1cc0ac54b Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 22 Jul 2021 09:26:54 +0200
Subject: [PATCH 1/2] Tell LVM to ignore the new devices file for now

We currently don't support working with the devices file and it's
not possible to use lvm.conf filters together with the devices
file so we need to tell LVM to ignore it until we can support it.
---
 blivet/devicelibs/lvm.py     | 4 ++++
 blivet/tasks/availability.py | 1 +
 2 files changed, 5 insertions(+)

diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py
index d56a76edc..989ecccaf 100644
--- a/blivet/devicelibs/lvm.py
+++ b/blivet/devicelibs/lvm.py
@@ -91,6 +91,10 @@ def _set_global_config():
     if filter_string:
         devices_string += " %s" % filter_string
 
+    # for now ignore the LVM devices file and rely on our filters
+    if availability.LVMDEVICES.available:
+        devices_string += " use_devicesfile=0"
+
     # devices_string can have (inside the brackets) "dir", "scan",
     # "preferred_names", "filter", "cache_dir", "write_cache_state",
     # "types", "sysfs_scan", "md_component_detection".  see man lvm.conf.
diff --git a/blivet/tasks/availability.py b/blivet/tasks/availability.py
index 1fd805901..5d3e295da 100644
--- a/blivet/tasks/availability.py
+++ b/blivet/tasks/availability.py
@@ -451,6 +451,7 @@ def available_resource(name):
 HFORMAT_APP = application("hformat")
 JFSTUNE_APP = application("jfs_tune")
 KPARTX_APP = application("kpartx")
+LVMDEVICES = application("lvmdevices")
 MKDOSFS_APP = application("mkdosfs")
 MKDOSFS_NEW_APP = application_by_version("mkdosfs", DOSFSTOOLS_VERSION)
 MKE2FS_APP = application_by_version("mke2fs", E2FSPROGS_VERSION)

From 08c137b5c98b24a9ba3df21f04cd20120c61198c Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 22 Jul 2021 11:33:46 +0200
Subject: [PATCH 2/2] Make sure LVM config is updated before running pvcreate

Our internal "global" LVM config is set during reset() but we have
test cases that run pvcreate without running reset() first so we
need to make sure to update the global config before running it
because the config string now also controls whether the new LVM
devices file will be used or not.
---
 blivet/formats/lvmpv.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py
index e4182adb2..ea84e9e4b 100644
--- a/blivet/formats/lvmpv.py
+++ b/blivet/formats/lvmpv.py
@@ -125,6 +125,8 @@ def _create(self, **kwargs):
         log_method_call(self, device=self.device,
                         type=self.type, status=self.status)
 
+        lvm._set_global_config()
+
         ea_yes = blockdev.ExtraArg.new("-y", "")
         blockdev.lvm.pvcreate(self.device, data_alignment=self.data_alignment, extra=[ea_yes])