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