neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone

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

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