neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone

Blame SOURCES/0010-Use-udev-to-determine-if-disk-is-a-multipath-member.patch

34c36b
From 8bdade5e60b746e8d992289e71123ad27146a7f1 Mon Sep 17 00:00:00 2001
34c36b
From: David Lehman <dlehman@redhat.com>
34c36b
Date: Wed, 24 Oct 2018 20:08:48 -0400
bda387
Subject: [PATCH] Use udev to determine if disk is a multipath member.
34c36b
34c36b
Related: rhbz#1575953
34c36b
---
34c36b
 blivet/populator/helpers/disklabel.py | 3 +--
34c36b
 tests/populator_test.py               | 6 ++----
34c36b
 2 files changed, 3 insertions(+), 6 deletions(-)
34c36b
34c36b
diff --git a/blivet/populator/helpers/disklabel.py b/blivet/populator/helpers/disklabel.py
34c36b
index c2acb117..db10638e 100644
34c36b
--- a/blivet/populator/helpers/disklabel.py
34c36b
+++ b/blivet/populator/helpers/disklabel.py
bda387
@@ -28,7 +28,6 @@
34c36b
 from ...errors import InvalidDiskLabelError
34c36b
 from ...storage_log import log_exception_info, log_method_call
34c36b
 from .formatpopulator import FormatPopulator
34c36b
-from ...static_data import mpath_members
34c36b
 
34c36b
 import logging
34c36b
 log = logging.getLogger("blivet")
bda387
@@ -44,7 +43,7 @@ def match(cls, data, device):
34c36b
         return (bool(udev.device_get_disklabel_type(data)) and
34c36b
                 not udev.device_is_biosraid_member(data) and
34c36b
                 udev.device_get_format(data) != "iso9660" and
34c36b
-                not (device.is_disk and mpath_members.is_mpath_member(device.path)))
34c36b
+                not (device.is_disk and udev.device_get_format(data) == "mpath_member"))
34c36b
 
34c36b
     def _get_kwargs(self):
34c36b
         kwargs = super(DiskLabelFormatPopulator, self)._get_kwargs()
bda387
diff --git a/tests/populator_test.py b/tests/populator_test.py
bda387
index b6f70319..d9c326d7 100644
bda387
--- a/tests/populator_test.py
bda387
+++ b/tests/populator_test.py
bda387
@@ -827,7 +827,6 @@ class HFSPopulatorTestCase(FormatPopulatorTestCase):
bda387
 class DiskLabelPopulatorTestCase(PopulatorHelperTestCase):
bda387
     helper_class = DiskLabelFormatPopulator
bda387
 
bda387
-    @patch("blivet.static_data.mpath_members.is_mpath_member", return_value=False)
bda387
     @patch("blivet.udev.device_is_biosraid_member", return_value=False)
bda387
     @patch("blivet.udev.device_get_format", return_value=None)
bda387
     @patch("blivet.udev.device_get_disklabel_type", return_value="dos")
bda387
@@ -836,7 +835,6 @@ def test_match(self, *args):
bda387
         device_get_disklabel_type = args[0]
bda387
         device_get_format = args[1]
bda387
         device_is_biosraid_member = args[2]
bda387
-        is_mpath_member = args[3]
bda387
 
bda387
         device = Mock()
bda387
         device.is_disk = True
bda387
@@ -861,9 +859,9 @@ def test_match(self, *args):
bda387
         device_is_biosraid_member.return_value = False
bda387
 
bda387
         # no match for multipath members
bda387
-        is_mpath_member.return_value = True
bda387
+        device_get_format.return_value = "mpath_member"
bda387
         self.assertFalse(self.helper_class.match(data, device))
bda387
-        is_mpath_member.return_value = False
bda387
+        device_get_format.return_value = None
bda387
 
bda387
     @patch("blivet.static_data.mpath_members.is_mpath_member", return_value=False)
bda387
     @patch("blivet.udev.device_is_biosraid_member", return_value=False)