[Ovirt-devel] [PATCH node] Checks if HostVG exists on any but the target device.

Darryl L. Pierce dpierce at redhat.com
Tue Feb 17 21:44:36 UTC 2009


If such a volume groups exists on a different device, then an error
message is show to the user and the partitioning stops. Otherwise, it
continues as expected.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-storage |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index faaf006..01ce3fc 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -85,6 +85,26 @@ check_partition_sizes()
         printf "Required Space : $need_size MB\n\n"
     fi
 
+    # check if an existing HostVG exists on a device other than the target
+    for vg in $(pvdisplay -c); do
+	eval $(echo $vg | awk '{match($0, "^([^:]*):([^:]*)", data); print "device="data[1]" name="data[2]}')
+	if [ "$name" == "HostVG" -a "${device:0:8}" != "$DRIVE" ]; then
+	    udi=$(hal-find-by-property --key block.device --string $device)
+	    name=$(hal-get-property --udi $udi --key storage.serial)
+	    printf "\n"
+	    printf "There appears to already be an installation of oVirt on another device:\n"
+	    printf "\t$device ($name)\n"
+	    printf "We cannot proceed until either this device is removed from the system\n"
+	    printf "or until the volume group is removed.\n"
+	    printf "\nTo remove the volume group, please open a command shell from the main\n"
+	    printf "setup menu and do:\n"
+	    printf "\nvgremove \"HostVG\"\n"
+	    printf "\nand then try to perform partition again.\n"
+	    printf "\n"
+	    return 1
+	fi
+    done
+
     return 0
 }
 
-- 
1.6.0.6




More information about the ovirt-devel mailing list