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

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