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