[PATCH 3/20] Use BlockDev's mpath plugin instead of devicelibs/mpath.py
vpodzime
installerbot-noreply at redhat.com
Fri Feb 27 15:31:52 UTC 2015
From: Vratislav Podzimek <vpodzime at redhat.com>
---
blivet/devicelibs/mpath.py | 31 -------------------------------
blivet/devicetree.py | 10 ++++++----
2 files changed, 6 insertions(+), 35 deletions(-)
delete mode 100644 blivet/devicelibs/mpath.py
diff --git a/blivet/devicelibs/mpath.py b/blivet/devicelibs/mpath.py
deleted file mode 100644
index 7bacc52..0000000
--- a/blivet/devicelibs/mpath.py
+++ /dev/null
@@ -1,31 +0,0 @@
-
-from .. import util
-
-import logging
-log = logging.getLogger("blivet")
-
-def flush_mpaths():
- util.run_program(["multipath", "-F"])
- check_output = util.capture_output(["multipath", "-ll"]).strip()
- if check_output:
- log.error("multipath: some devices could not be flushed")
-
-def is_multipath_member(path):
- return (util.run_program(["multipath", "-c", path]) == 0)
-
-def set_friendly_names(enabled=True):
- """ Set the state of friendly names in multipathd.
-
- NOTE: If you call this you also need to take appropriate steps to make
- sure the devicetree contains devices with the appropriate names.
- They will not be updated automatically.
- """
- if enabled:
- val = "y"
- else:
- val = "n"
-
- # --find_multipaths is important to keep multipath from making up multipath devices
- # that aren't really multipath
- cmd = ["mpathconf", "--find_multipaths", "y", "--user_friendly_names", val, "--with_multipathd", "y"]
- return (util.run_program(cmd) == 0)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 322087f..2fe4dfe 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -27,6 +27,9 @@
import pprint
import copy
+from gi.repository import BlockDev as blockdev
+from gi.repository import GLib
+
from .errors import CryptoError, DeviceError, DeviceTreeError, DiskLabelCommitError, DMError, FSError, InvalidDiskLabelError, LUKSError, MDRaidError, StorageError, UnusableConfigurationError
from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, BTRFSSnapShotDevice
from .devices import DASDDevice, DMDevice, DMLinearDevice, DMRaidArrayDevice, DiskDevice
@@ -45,7 +48,6 @@
from .devicelibs import mdraid
from .devicelibs import dm
from .devicelibs import lvm
-from .devicelibs import mpath
from .devicelibs import loop
from .devicelibs import edd
from . import udev
@@ -1173,7 +1175,7 @@ def addUdevDevice(self, info):
device = None
if device and device.isDisk and \
- mpath.is_multipath_member(device.path):
+ blockdev.mpath_is_mpath_member(device.path):
# newly added device (eg iSCSI) could make this one a multipath member
if device.format and device.format.type != "multipath_member":
log.debug("%s newly detected as multipath member, dropping old format and removing kids", device.name)
@@ -1769,7 +1771,7 @@ def handleUdevDeviceFormat(self, info, device):
format_type = udev.device_get_format(info)
serial = udev.device_get_serial(info)
- is_multipath_member = mpath.is_multipath_member(device.path)
+ is_multipath_member = blockdev.mpath_is_mpath_member(device.path)
if is_multipath_member:
format_type = "multipath_member"
@@ -2128,7 +2130,7 @@ def _populate(self):
self.dropLVMCache()
if flags.installer_mode and not flags.image_install:
- mpath.set_friendly_names(enabled=flags.multipath_friendly_names)
+ blockdev.mpath_set_friendly_names(flags.multipath_friendly_names)
self.setupDiskImages()
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/3c2d9dde9f235ff87bfe7e76e02506e953b70e05
More information about the anaconda-patches
mailing list