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