neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
Blob Blame History Raw
From 8bdade5e60b746e8d992289e71123ad27146a7f1 Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Wed, 24 Oct 2018 20:08:48 -0400
Subject: [PATCH] Use udev to determine if disk is a multipath member.

Related: rhbz#1575953
---
 blivet/populator/helpers/disklabel.py | 3 +--
 tests/populator_test.py               | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/blivet/populator/helpers/disklabel.py b/blivet/populator/helpers/disklabel.py
index c2acb117..db10638e 100644
--- a/blivet/populator/helpers/disklabel.py
+++ b/blivet/populator/helpers/disklabel.py
@@ -28,7 +28,6 @@
 from ...errors import InvalidDiskLabelError
 from ...storage_log import log_exception_info, log_method_call
 from .formatpopulator import FormatPopulator
-from ...static_data import mpath_members
 
 import logging
 log = logging.getLogger("blivet")
@@ -44,7 +43,7 @@ def match(cls, data, device):
         return (bool(udev.device_get_disklabel_type(data)) and
                 not udev.device_is_biosraid_member(data) and
                 udev.device_get_format(data) != "iso9660" and
-                not (device.is_disk and mpath_members.is_mpath_member(device.path)))
+                not (device.is_disk and udev.device_get_format(data) == "mpath_member"))
 
     def _get_kwargs(self):
         kwargs = super(DiskLabelFormatPopulator, self)._get_kwargs()
diff --git a/tests/populator_test.py b/tests/populator_test.py
index b6f70319..d9c326d7 100644
--- a/tests/populator_test.py
+++ b/tests/populator_test.py
@@ -827,7 +827,6 @@ class HFSPopulatorTestCase(FormatPopulatorTestCase):
 class DiskLabelPopulatorTestCase(PopulatorHelperTestCase):
     helper_class = DiskLabelFormatPopulator
 
-    @patch("blivet.static_data.mpath_members.is_mpath_member", return_value=False)
     @patch("blivet.udev.device_is_biosraid_member", return_value=False)
     @patch("blivet.udev.device_get_format", return_value=None)
     @patch("blivet.udev.device_get_disklabel_type", return_value="dos")
@@ -836,7 +835,6 @@ def test_match(self, *args):
         device_get_disklabel_type = args[0]
         device_get_format = args[1]
         device_is_biosraid_member = args[2]
-        is_mpath_member = args[3]
 
         device = Mock()
         device.is_disk = True
@@ -861,9 +859,9 @@ def test_match(self, *args):
         device_is_biosraid_member.return_value = False
 
         # no match for multipath members
-        is_mpath_member.return_value = True
+        device_get_format.return_value = "mpath_member"
         self.assertFalse(self.helper_class.match(data, device))
-        is_mpath_member.return_value = False
+        device_get_format.return_value = None
 
     @patch("blivet.static_data.mpath_members.is_mpath_member", return_value=False)
     @patch("blivet.udev.device_is_biosraid_member", return_value=False)