5c7b2d
From a977e8389a09615615dc76dee8aaaea1cc0ac54b Mon Sep 17 00:00:00 2001
5c7b2d
From: Vojtech Trefny <vtrefny@redhat.com>
5c7b2d
Date: Thu, 22 Jul 2021 09:26:54 +0200
5c7b2d
Subject: [PATCH 1/2] Tell LVM to ignore the new devices file for now
5c7b2d
5c7b2d
We currently don't support working with the devices file and it's
5c7b2d
not possible to use lvm.conf filters together with the devices
5c7b2d
file so we need to tell LVM to ignore it until we can support it.
5c7b2d
---
5c7b2d
 blivet/devicelibs/lvm.py     | 4 ++++
5c7b2d
 blivet/tasks/availability.py | 1 +
5c7b2d
 2 files changed, 5 insertions(+)
5c7b2d
5c7b2d
diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py
5c7b2d
index d56a76edc..989ecccaf 100644
5c7b2d
--- a/blivet/devicelibs/lvm.py
5c7b2d
+++ b/blivet/devicelibs/lvm.py
5c7b2d
@@ -91,6 +91,10 @@ def _set_global_config():
5c7b2d
     if filter_string:
5c7b2d
         devices_string += " %s" % filter_string
5c7b2d
 
5c7b2d
+    # for now ignore the LVM devices file and rely on our filters
5c7b2d
+    if availability.LVMDEVICES.available:
5c7b2d
+        devices_string += " use_devicesfile=0"
5c7b2d
+
5c7b2d
     # devices_string can have (inside the brackets) "dir", "scan",
5c7b2d
     # "preferred_names", "filter", "cache_dir", "write_cache_state",
5c7b2d
     # "types", "sysfs_scan", "md_component_detection".  see man lvm.conf.
5c7b2d
diff --git a/blivet/tasks/availability.py b/blivet/tasks/availability.py
5c7b2d
index 1fd805901..5d3e295da 100644
5c7b2d
--- a/blivet/tasks/availability.py
5c7b2d
+++ b/blivet/tasks/availability.py
5c7b2d
@@ -451,6 +451,7 @@ def available_resource(name):
5c7b2d
 HFORMAT_APP = application("hformat")
5c7b2d
 JFSTUNE_APP = application("jfs_tune")
5c7b2d
 KPARTX_APP = application("kpartx")
5c7b2d
+LVMDEVICES = application("lvmdevices")
5c7b2d
 MKDOSFS_APP = application("mkdosfs")
5c7b2d
 MKDOSFS_NEW_APP = application_by_version("mkdosfs", DOSFSTOOLS_VERSION)
5c7b2d
 MKE2FS_APP = application_by_version("mke2fs", E2FSPROGS_VERSION)
5c7b2d
5c7b2d
From 08c137b5c98b24a9ba3df21f04cd20120c61198c Mon Sep 17 00:00:00 2001
5c7b2d
From: Vojtech Trefny <vtrefny@redhat.com>
5c7b2d
Date: Thu, 22 Jul 2021 11:33:46 +0200
5c7b2d
Subject: [PATCH 2/2] Make sure LVM config is updated before running pvcreate
5c7b2d
5c7b2d
Our internal "global" LVM config is set during reset() but we have
5c7b2d
test cases that run pvcreate without running reset() first so we
5c7b2d
need to make sure to update the global config before running it
5c7b2d
because the config string now also controls whether the new LVM
5c7b2d
devices file will be used or not.
5c7b2d
---
5c7b2d
 blivet/formats/lvmpv.py | 2 ++
5c7b2d
 1 file changed, 2 insertions(+)
5c7b2d
5c7b2d
diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py
5c7b2d
index e4182adb2..ea84e9e4b 100644
5c7b2d
--- a/blivet/formats/lvmpv.py
5c7b2d
+++ b/blivet/formats/lvmpv.py
5c7b2d
@@ -125,6 +125,8 @@ def _create(self, **kwargs):
5c7b2d
         log_method_call(self, device=self.device,
5c7b2d
                         type=self.type, status=self.status)
5c7b2d
 
5c7b2d
+        lvm._set_global_config()
5c7b2d
+
5c7b2d
         ea_yes = blockdev.ExtraArg.new("-y", "")
5c7b2d
         blockdev.lvm.pvcreate(self.device, data_alignment=self.data_alignment, extra=[ea_yes])
5c7b2d