Joey Boggs has uploaded a new change for review.

Change subject: check for volume groups with storage_domain tag before removing 
them forcefully
......................................................................

check for volume groups with storage_domain tag before removing them forcefully

rhbz#889071

Signed-off-by: Joey Boggs <[email protected]>
Change-Id: Id2af60c0a2e5dda7a0075e081c3b8d5a6c6c975b
---
M dracut/ovirt-cleanup.sh
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/31/15631/1

diff --git a/dracut/ovirt-cleanup.sh b/dracut/ovirt-cleanup.sh
index 8717c8c..a831ecb 100755
--- a/dracut/ovirt-cleanup.sh
+++ b/dracut/ovirt-cleanup.sh
@@ -112,7 +112,7 @@
 
 fatal() {
     [ -x /bin/plymouth ] && /bin/plymouth --hide-splash
-    echo "<1>dracut: FATAL: $@" > /dev/kmsg
+    echo "\n<1>dracut: FATAL: $@" > /dev/kmsg
     echo "dracut: FATAL: $@" >&2
 }
 
@@ -125,6 +125,8 @@
     if [ -f "/etc/lvm/lvm.conf" ]; then
         sed -i "s/locking_type =.*/locking_type = 0/" /etc/lvm/lvm.conf
     fi
+    sdevs=$(lvm vgs -o pv_name,tags | grep storage_domain | while read line; 
do echo $line | awk '{print $1}'; done)
+
     IFS=$oldIFS
     for i in $(lvm pvs --noheadings -o pv_name,vg_name --separator=, $device 
2>/dev/null); do
         pv="${i%%,*}"
@@ -140,6 +142,12 @@
                      fi
                 done
                 IFS=$oldIFS
+                for dev in $sdevs; do
+                    if [ $dev = $ipv ]; then
+                        fatal "Warning: '$ipv' is a member of a storage domain 
and may not be removed"
+                    exit 1
+                    fi
+                done
                 if [ $imach -eq 0 ]; then
                     fatal "LV '$ipv' is a member of VG '$vg' and must be 
included in \$storage_init"
                     fatal "Not all member PVs of '$vg' are given in the 
storage_init parameter, exiting"


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id2af60c0a2e5dda7a0075e081c3b8d5a6c6c975b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <[email protected]>
_______________________________________________
node-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/node-patches

Reply via email to