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