python-blivet/SOURCES/0009-Do-not-use-BlockDev-utils_have_kernel_module-to-check-for-modules.patch

48 lines
1.5 KiB
Diff
Raw Normal View History

2020-11-03 12:02:10 +00:00
From 7303f4a3f2fe3280339f6303dcff31b6ade12176 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 9 Jul 2020 16:30:55 +0200
Subject: [PATCH] Do not use BlockDev.utils_have_kernel_module to check for
modules
The function unfortunately uses only the name when searching for
the module and we need to use aliases for modules like ext2 and
ext3. So we need to use "modprobe --dry-run" instead.
---
blivet/formats/fs.py | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index eee15aaa..bcfbc08e 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -60,12 +60,6 @@
import logging
log = logging.getLogger("blivet")
-import gi
-gi.require_version("GLib", "2.0")
-gi.require_version("BlockDev", "2.0")
-
-from gi.repository import GLib
-from gi.repository import BlockDev
AVAILABLE_FILESYSTEMS = kernel_filesystems
@@ -462,13 +456,13 @@ def check_module(self):
for module in self._modules:
try:
- succ = BlockDev.utils_have_kernel_module(module)
- except GLib.GError as e:
+ rc = util.run_program(["modprobe", "--dry-run", module])
+ except OSError as e:
log.error("Could not check kernel module availability %s: %s", module, e)
self._supported = False
return
- if not succ:
+ if rc:
log.debug("Kernel module %s not available", module)
self._supported = False
return