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