[Ovirt-devel] [PATCH node 5/6] Add handling so that install to mpath device works.

Michael Burns mburns at redhat.com
Sat Sep 26 02:33:57 UTC 2009


Detects if user enters /dev/mpath and changes to /dev/mapper instead
runs kpartx instead of blockdev to reload partitions if mpath device used.
Runs kpartx after parted commands to reload partitions of mpath device.

Update ovirt-config-boot to handle /dev/mapper mpath device.
Previously, it was not added to kernel args correctly.

rhbz#510691

Signed-off-by: Mike Burns <mburns at redhat.com>
Signed-off-by: Michael Burns <mburns at redhat.com>
---
 scripts/ovirt-config-boot    |    5 +++++
 scripts/ovirt-config-storage |   16 +++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
index 36fdf41..87cf832 100755
--- a/scripts/ovirt-config-boot
+++ b/scripts/ovirt-config-boot
@@ -204,6 +204,11 @@ set -e\
         # to avoid waiting for udev
         mpath_id=${disk#/dev/mpath/}
         bootparams="$bootparams mpath filter=/dev/mapper/$mpath_id"
+    elif [[ "$disk" =~ "^/dev/mapper/" ]]; then
+        mpath_id=${disk#/dev/mapper/}
+        if [[ -e /dev/mpath/$mpath_id ]]; then
+          bootparams="$bootparams mpath filter=$disk"
+        fi
     fi
     # add multipath executables
     mkdir -p sbin
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index 473826f..91662c5 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -335,10 +335,21 @@ perform_partitioning()
     # begin critical section
     set -e

+    # change /dev/mpath device to /dev/mapper
+    if [[ "$DRIVE" =~ "^/dev/mpath/" ]]; then
+      log "renaming /dev/mpath to be /dev/mapper"
+      mpath_id=${DRIVE#/dev/mpath/}
+      DRIVE=/dev/mapper/$mpath_id
+    fi
+
     # FIXME: save a backup copy, just in case?
     log "Wiping old boot sector"
     dd if=/dev/zero of=$DRIVE bs=1024K count=1
-    blockdev --rereadpt $DRIVE
+    if [[ "$DRIVE" =~ "^/dev/mapper" ]]; then
+      kpartx -a $DRIVE
+    else
+      blockdev --rereadpt $DRIVE
+    fi
     partprobe -s $DRIVE

     MEM_SIZE_MB=$(echo "scale=0; $MEM_SIZE_MB / 1024;" | bc -l)
@@ -355,6 +366,9 @@ perform_partitioning()
     parted $DRIVE -s "set 2 lvm on"
     parted $DRIVE -s "print"
     udevadm settle 2> /dev/null || udevsettle
+    if [[ "$DRIVE" =~ "^/dev/mapper" ]]; then
+      kpartx -a $DRIVE
+    fi

     # sync GPT to the legacy MBR partitions
     if [ "gpt" == "$LABEL_TYPE" ]; then
-- 
1.6.2.5




More information about the ovirt-devel mailing list