|
|
f01d01 |
From 4e6a322d32d2a12f8a87ab763a6286cf3d7b5c27 Mon Sep 17 00:00:00 2001
|
|
|
f01d01 |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
|
f01d01 |
Date: Tue, 8 Sep 2020 13:57:40 +0200
|
|
|
f01d01 |
Subject: [PATCH] Use UnusableConfigurationError for partially hidden multipath
|
|
|
f01d01 |
devices
|
|
|
f01d01 |
|
|
|
f01d01 |
Follow-up for https://github.com/storaged-project/blivet/pull/883
|
|
|
f01d01 |
to make Anaconda show an error message instead of crashing.
|
|
|
f01d01 |
|
|
|
f01d01 |
Resolves: rhbz#1877052
|
|
|
f01d01 |
---
|
|
|
f01d01 |
blivet/devicetree.py | 4 ++--
|
|
|
f01d01 |
blivet/errors.py | 6 ++++++
|
|
|
f01d01 |
tests/devicetree_test.py | 4 ++--
|
|
|
f01d01 |
3 files changed, 10 insertions(+), 4 deletions(-)
|
|
|
f01d01 |
|
|
|
f01d01 |
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
|
|
|
f01d01 |
index 2afb0d0e..57a9bbd7 100644
|
|
|
f01d01 |
--- a/blivet/devicetree.py
|
|
|
f01d01 |
+++ b/blivet/devicetree.py
|
|
|
f01d01 |
@@ -32,7 +32,7 @@ from gi.repository import BlockDev as blockdev
|
|
|
f01d01 |
|
|
|
f01d01 |
from .actionlist import ActionList
|
|
|
f01d01 |
from .callbacks import callbacks
|
|
|
f01d01 |
-from .errors import DeviceError, DeviceTreeError, StorageError, DuplicateUUIDError
|
|
|
f01d01 |
+from .errors import DeviceError, DeviceTreeError, StorageError, DuplicateUUIDError, InvalidMultideviceSelection
|
|
|
f01d01 |
from .deviceaction import ActionDestroyDevice, ActionDestroyFormat
|
|
|
f01d01 |
from .devices import BTRFSDevice, NoDevice, PartitionDevice
|
|
|
f01d01 |
from .devices import LVMLogicalVolumeDevice, LVMVolumeGroupDevice
|
|
|
f01d01 |
@@ -936,7 +936,7 @@ class DeviceTreeBase(object):
|
|
|
f01d01 |
if is_ignored:
|
|
|
f01d01 |
if len(disk.children) == 1:
|
|
|
f01d01 |
if not all(self._is_ignored_disk(d) for d in disk.children[0].parents):
|
|
|
f01d01 |
- raise DeviceTreeError("Including only a subset of raid/multipath member disks is not allowed.")
|
|
|
f01d01 |
+ raise InvalidMultideviceSelection("Including only a subset of raid/multipath member disks is not allowed.")
|
|
|
f01d01 |
|
|
|
f01d01 |
# and also children like fwraid or mpath
|
|
|
f01d01 |
self.hide(disk.children[0])
|
|
|
f01d01 |
diff --git a/blivet/errors.py b/blivet/errors.py
|
|
|
f01d01 |
index 811abf81..7a93f1ce 100644
|
|
|
f01d01 |
--- a/blivet/errors.py
|
|
|
f01d01 |
+++ b/blivet/errors.py
|
|
|
f01d01 |
@@ -233,6 +233,12 @@ class DuplicateVGError(UnusableConfigurationError):
|
|
|
f01d01 |
"Hint 2: You can get the VG UUIDs by running "
|
|
|
f01d01 |
"'pvs -o +vg_uuid'.")
|
|
|
f01d01 |
|
|
|
f01d01 |
+
|
|
|
f01d01 |
+class InvalidMultideviceSelection(UnusableConfigurationError):
|
|
|
f01d01 |
+ suggestion = N_("All parent devices must be selected when choosing exclusive "
|
|
|
f01d01 |
+ "or ignored disks for a multipath or firmware RAID device.")
|
|
|
f01d01 |
+
|
|
|
f01d01 |
+
|
|
|
f01d01 |
# DeviceAction
|
|
|
f01d01 |
|
|
|
f01d01 |
|
|
|
f01d01 |
diff --git a/tests/devicetree_test.py b/tests/devicetree_test.py
|
|
|
f01d01 |
index 6032e7f6..4e47ffc3 100644
|
|
|
f01d01 |
--- a/tests/devicetree_test.py
|
|
|
f01d01 |
+++ b/tests/devicetree_test.py
|
|
|
f01d01 |
@@ -5,7 +5,7 @@ import six
|
|
|
f01d01 |
import unittest
|
|
|
f01d01 |
|
|
|
f01d01 |
from blivet.actionlist import ActionList
|
|
|
f01d01 |
-from blivet.errors import DeviceTreeError, DuplicateUUIDError
|
|
|
f01d01 |
+from blivet.errors import DeviceTreeError, DuplicateUUIDError, InvalidMultideviceSelection
|
|
|
f01d01 |
from blivet.deviceaction import ACTION_TYPE_DESTROY, ACTION_OBJECT_DEVICE
|
|
|
f01d01 |
from blivet.devicelibs import lvm
|
|
|
f01d01 |
from blivet.devices import DiskDevice
|
|
|
f01d01 |
@@ -512,5 +512,5 @@ class DeviceTreeIgnoredExclusiveMultipathTestCase(unittest.TestCase):
|
|
|
f01d01 |
self.tree.ignored_disks = ["sda", "sdb"]
|
|
|
f01d01 |
self.tree.exclusive_disks = []
|
|
|
f01d01 |
|
|
|
f01d01 |
- with self.assertRaises(DeviceTreeError):
|
|
|
f01d01 |
+ with self.assertRaises(InvalidMultideviceSelection):
|
|
|
f01d01 |
self.tree._hide_ignored_disks()
|
|
|
f01d01 |
--
|
|
|
f01d01 |
2.26.2
|
|
|
f01d01 |
|