[node-patches] Change in ovirt-node[master]: installer: Detect correct wwid

fabiand at redhat.com fabiand at redhat.com
Mon Jan 5 16:11:49 UTC 2015


Fabian Deutsch has uploaded a new change for review.

Change subject: installer: Detect correct wwid
......................................................................

installer: Detect correct wwid

Previously the wwid of the first mpath device was used, which is
obviously wrong.
Now the wwid of the correct disk is being used.
This change also required to find the parent of a partition, which is
reponsible for most line changes in this commit.

Change-Id: If656429f08f65b0f8da2d7b96dfab031417eae44
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirtnode/install.py
1 file changed, 14 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/88/36588/1

diff --git a/src/ovirtnode/install.py b/src/ovirtnode/install.py
index 1afd94f..410f397 100755
--- a/src/ovirtnode/install.py
+++ b/src/ovirtnode/install.py
@@ -564,15 +564,26 @@
         is_mpath_root = self.disk and self.disk.startswith("/dev/mapper")
         has_mpath_wwid = "mpath.wwid=" in self.bootparams
         if is_mpath_root and not has_mpath_wwid:
-            """We need to specify the wwid of the root device, if it
-            is using multiple paths, to prevent races within dracut.
+            """We need to specify the wwid of the root device if it
+            is using multiple paths to prevent races within dracut.
             Basically there are two options:
             1. bake wwid of root device into initrd
             2. pass wwid of root device on kernel cmdline
             I choose 2 because it seems to be less invasive.
             https://bugzilla.redhat.com/show_bug.cgi?id=1152948
             """
-            wwidcmd = "multipath -ll %s | egrep -o '^.*dm-[0-9]' | cut -d' ' -f1" % self.disk
+            lsblkcmd = "lsblk -inls %s | awk 'FNR==2 {print $1}'" % self.disk
+            lsblkproc = _functions.subprocess_closefds(lsblkcmd, shell=True,
+                                                       stdout=subprocess.PIPE,
+                                                       stderr=subprocess.STDOUT)
+            lsblkout, lsblkerr = lsblkproc.communicate()
+            logger.debug("lsblk returned: %s -- %s" % (lsblkout, lsblkerr))
+            if not lsblkout.strip():
+                raise RuntimeError("Failed to determin parent of partition: %s" % self.disk)
+            part_parent = "/dev/mapper/" + lsblkout.strip()
+            logger.debug("lsblk found parent for partition %s: %s" % (self.disk, part_parent))
+
+            wwidcmd = "multipath -ll %s | egrep -o '^.*dm-[0-9]' | cut -d' ' -f1" % part_parent
             logger.debug("Checking device for multipath: %s" % wwidcmd)
             wwidproc = _functions.subprocess_closefds(wwidcmd, shell=True,
                                                       stdout=subprocess.PIPE,


-- 
To view, visit http://gerrit.ovirt.org/36588
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If656429f08f65b0f8da2d7b96dfab031417eae44
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list