neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone

Blame SOURCES/0011-Don-t-crash-if-blockdev-mpath-plugin-isn-t-available.patch

0b05ab
From 5b0b1ffcf0d27306e52476984ebd8eb3af4a11aa Mon Sep 17 00:00:00 2001
0b05ab
From: David Lehman <dlehman@redhat.com>
0b05ab
Date: Mon, 25 Feb 2019 11:14:30 -0500
0b05ab
Subject: [PATCH] Don't crash if blockdev mpath plugin isn't available.
0b05ab
 (#1672971)
0b05ab
0b05ab
---
0b05ab
 blivet/static_data/mpath_info.py | 7 +++++--
0b05ab
 1 file changed, 5 insertions(+), 2 deletions(-)
0b05ab
0b05ab
diff --git a/blivet/static_data/mpath_info.py b/blivet/static_data/mpath_info.py
0b05ab
index b16f3c65..49ba4709 100644
0b05ab
--- a/blivet/static_data/mpath_info.py
0b05ab
+++ b/blivet/static_data/mpath_info.py
0b05ab
@@ -27,6 +27,8 @@ from gi.repository import BlockDev as blockdev
0b05ab
 import logging
0b05ab
 log = logging.getLogger("blivet")
0b05ab
 
0b05ab
+from ..tasks import availability
0b05ab
+
0b05ab
 
0b05ab
 class MpathMembers(object):
0b05ab
     """A cache for querying multipath member devices"""
0b05ab
@@ -40,7 +42,7 @@ class MpathMembers(object):
0b05ab
         :param str device: path of the device to query
0b05ab
 
0b05ab
         """
0b05ab
-        if self._members is None:
0b05ab
+        if self._members is None and availability.BLOCKDEV_MPATH_PLUGIN.available:
0b05ab
             self._members = set(blockdev.mpath.get_mpath_members())
0b05ab
 
0b05ab
         device = os.path.realpath(device)
0b05ab
@@ -56,7 +58,8 @@ class MpathMembers(object):
0b05ab
         """
0b05ab
         device = os.path.realpath(device)
0b05ab
         device = device[len("/dev/"):]
0b05ab
-        if blockdev.mpath.is_mpath_member(device):
0b05ab
+
0b05ab
+        if availability.BLOCKDEV_MPATH_PLUGIN.available and blockdev.mpath.is_mpath_member(device):
0b05ab
             self._members.add(device)
0b05ab
 
0b05ab
     def drop_cache(self):
0b05ab
-- 
0b05ab
2.17.2
0b05ab