[node-patches] Change in ovirt-node[master]: add passive array test for checking storage_domain tag befor...

jboggs at redhat.com jboggs at redhat.com
Tue Jul 9 13:17:47 UTC 2013


Joey Boggs has uploaded a new change for review.

Change subject: add passive array test for checking storage_domain tag before wiping lvm
......................................................................

add passive array test for checking storage_domain tag before wiping lvm

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=980477
Signed-off-by: Joey Boggs <jboggs at redhat.com>
Change-Id: Iee9511e491fd058c0c5556a818a93cc3d58f8ea5
---
M dracut/ovirt-cleanup.sh
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/20/16620/1

diff --git a/dracut/ovirt-cleanup.sh b/dracut/ovirt-cleanup.sh
index a831ecb..29b700e 100755
--- a/dracut/ovirt-cleanup.sh
+++ b/dracut/ovirt-cleanup.sh
@@ -94,6 +94,13 @@
     if [ -z "$device" ]; then
         continue
     fi
+    # check if valid mpath device
+    if multipath -c $device; then
+        pdev=$(multipath -ll $device|head -n 1|awk {'print $1'})
+        if [ -e /dev/mapper/"$pdev" ]; then
+            device="/dev/mapper/$pdev"
+        fi
+    fi
     info "Looking for device and partitions on '$device'"
     IFS=$oldIFS
     for slave in $(ls $device*); do
@@ -117,6 +124,23 @@
 }
 
 for device in $lvm_storage_init; do
+    vgname=$(lvm pvs -o vg_name "$device" --noheadings|sed 's/\s//g')
+    if lvm vgs --noheadings -o pv_name,tags "$vgname"|grep -q storage_domain; then
+        if [[ $device =~ "/dev/mapper" ]]; then
+            for dev in $storage_init; do
+                basedev=$(basename $dev)
+                mpathbasedev=$(multipath -ll $device |grep $basedev|awk {'print $3'})
+                if [[ -n $mpathbasedev ]]; then
+                   echo "dracut: FATAL: Warning: '$device' contains /dev/$mpathbasedev"
+                fi
+            done
+        fi
+        fatal "Warning: '$device' is a member of a storage domain and may not be removed"
+        exit 1
+    fi
+done
+
+for device in $lvm_storage_init; do
     if [ -z "$device" ]; then
         continue
     fi


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee9511e491fd058c0c5556a818a93cc3d58f8ea5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list