python-blivet/0004-Add-device-symlinks-to-the-PVs-dictionary-for-MD-RAI.patch
David Lehman 0d7a83bf90 Fixes for F25 blockers and freeze exceptions.
- Use correct type for port in GVariant tuple (awilliam)
- iSCSI: Store auth info in NodeInfo tuples (awilliam)
- iSCSI: turn `iscsi.initiator_set` into a property (awilliam)
- Add device symlinks to the PVs dictionary for MD RAID PVs (#1389130) (vpodzime)
2016-11-07 12:10:56 -05:00

46 lines
2.0 KiB
Diff

From 274b0bfb6aa923a82662e754030ebce4d8694901 Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Thu, 3 Nov 2016 12:53:03 +0100
Subject: [PATCH 4/4] Add device symlinks to the PVs dictionary for MD RAID PVs
(#1389130)
Otherwise if the symlink is used to search for the PV info, it's not found and
everything on that PV is ignored which leads e.g. to issues when removing the PV
(as described in the bug) and others.
---
blivet/static_data/lvm_info.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/blivet/static_data/lvm_info.py b/blivet/static_data/lvm_info.py
index ed2e995..4f5a274 100644
--- a/blivet/static_data/lvm_info.py
+++ b/blivet/static_data/lvm_info.py
@@ -57,7 +57,23 @@ class PVsInfo(object):
def cache(self):
if self._pvs_cache is None:
pvs = blockdev.lvm.pvs()
- self._pvs_cache = dict((pv.pv_name, pv) for pv in pvs) # pylint: disable=attribute-defined-outside-init
+ self._pvs_cache = dict() # pylint: disable=attribute-defined-outside-init
+ for pv in pvs:
+ self._pvs_cache[pv.pv_name] = pv
+ # TODO: add get_all_device_symlinks() and resolve_device_symlink() functions to
+ # libblockdev and use them here
+ if pv.pv_name.startswith("/dev/md/"):
+ try:
+ md_node = blockdev.md.node_from_name(pv.pv_name[len("/dev/md/"):])
+ self._pvs_cache["/dev/" + md_node] = pv
+ except blockdev.MDRaidError:
+ pass
+ elif pv.pv_name.startswith("/dev/md"):
+ try:
+ md_named_dev = blockdev.md.name_from_node(pv.pv_name[len("/dev/"):])
+ self._pvs_cache["/dev/md/" + md_named_dev] = pv
+ except blockdev.MDRaidError:
+ pass
return self._pvs_cache
--
2.7.4