Blob Blame History Raw
From 5b0b1ffcf0d27306e52476984ebd8eb3af4a11aa Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Mon, 25 Feb 2019 11:14:30 -0500
Subject: [PATCH] Don't crash if blockdev mpath plugin isn't available.
 (#1672971)

---
 blivet/static_data/mpath_info.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/blivet/static_data/mpath_info.py b/blivet/static_data/mpath_info.py
index b16f3c65..49ba4709 100644
--- a/blivet/static_data/mpath_info.py
+++ b/blivet/static_data/mpath_info.py
@@ -27,6 +27,8 @@ from gi.repository import BlockDev as blockdev
 import logging
 log = logging.getLogger("blivet")
 
+from ..tasks import availability
+
 
 class MpathMembers(object):
     """A cache for querying multipath member devices"""
@@ -40,7 +42,7 @@ class MpathMembers(object):
         :param str device: path of the device to query
 
         """
-        if self._members is None:
+        if self._members is None and availability.BLOCKDEV_MPATH_PLUGIN.available:
             self._members = set(blockdev.mpath.get_mpath_members())
 
         device = os.path.realpath(device)
@@ -56,7 +58,8 @@ class MpathMembers(object):
         """
         device = os.path.realpath(device)
         device = device[len("/dev/"):]
-        if blockdev.mpath.is_mpath_member(device):
+
+        if availability.BLOCKDEV_MPATH_PLUGIN.available and blockdev.mpath.is_mpath_member(device):
             self._members.add(device)
 
     def drop_cache(self):
-- 
2.17.2