[Ovirt-devel] [PATCH node] Made all o-c-* scripts more robust when called in AUTO mode.

Darryl L. Pierce dpierce at redhat.com
Mon Apr 27 17:24:49 UTC 2009


If sufficient arguments are not present, then an error is reported and
the script exited.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-networking |   11 ++++++++---
 scripts/ovirt-config-storage    |   26 ++++++++++++++++----------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index 9a1ff2b..3042bd6 100755
--- a/scripts/ovirt-config-networking
+++ b/scripts/ovirt-config-networking
@@ -247,9 +247,14 @@ function setup_menu
 }
 
 if [ "$1" == "AUTO" ]; then
-    configure_interface "$OVIRT_BOOTIF" AUTO
-    configure_dns "$OVIRT_DNS" AUTO
-    configure_ntp "$OVIRT_NTP" AUTO
+    if [ -n "$OVIRT_BOOTIF" ]; then
+	configure_interface "$OVIRT_BOOTIF" AUTO
+	configure_dns "$OVIRT_DNS" AUTO
+	configure_ntp "$OVIRT_NTP" AUTO
+    else
+	printf "No network interface specified. Unable to configure networking."
+	exit 0
+    fi
 else
     setup_menu
 
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index 73dcaf4..815c8e0 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -281,6 +281,7 @@ wipe_lvm_on_disk()
 
 perform_partitioning()
 {
+    log "Partitioning drive: $DRIVE"
     if [ -z "$DRIVE" ]; then
         printf "\nNo storage device selected.\n"
         return
@@ -501,17 +502,22 @@ else
 fi
 
 if [ "$1" == "AUTO" ]; then
-    # do not format if HostVG exists on selected disk...
-    pvs -o vg_name --noheadings $DRIVE* 2>/dev/null|grep -q -m1 "HostVG"
-    existingHostVG=$?
-    # ... unless overridden by ovirt_firstboot parameter
-    if is_firstboot || [ $existingHostVG -ne 0 ]; then
-        if check_partition_sizes; then
-            printf "Partitioning hard disk..."
-            perform_partitioning
-        fi
+    log "Beginning automatic disk partitioning.\n"
+    if [ -n "$OVIRT_INIT" ]; then
+        # do not format if HostVG exists on selected disk...
+	pvs -o vg_name --noheadings $DRIVE* 2>/dev/null|grep -q -m1 "HostVG"
+	existingHostVG=$?
+        # ... unless overridden by ovirt_firstboot parameter
+	if is_firstboot || [ $existingHostVG -ne 0 ]; then
+            if check_partition_sizes; then
+		log "Partitioning hard disk..."
+		perform_partitioning
+            fi
+	else
+            log "Skip disk partitioning, HostVG exists"
+	fi
     else
-        log "Skip disk partitioning, HostVG exists"
+	log "Missing device parameter: unable to partition any disk"
     fi
 else
     OPTIONS="Configure Review Partition Quit"
-- 
1.6.0.6




More information about the ovirt-devel mailing list