[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Ovirt-devel] [PATCH node] fix iscsi installation problems



This patch fixes a few problems encountered with installing to an iscsi backed root partition as well as a normal local disk install.

---
 scripts/ovirt-config-boot       |   10 ++++++----
 scripts/ovirt-config-networking |    8 +++++---
 scripts/ovirt-config-storage    |   17 ++++++++++++++++-
 scripts/ovirt-functions         |   27 ++++++++++++++++++---------
 4 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
index 72bcd9b..fc6649f 100755
--- a/scripts/ovirt-config-boot
+++ b/scripts/ovirt-config-boot
@@ -34,7 +34,7 @@ ovirt_boot_setup() {
         found_boot=true
         grub_dev_label=Boot
     elif findfs LABEL=Root 2>&1 >/dev/null ; then
-        found_boot=true
+        found_boot=false
         grub_dev_label=Root
     fi
     if $found_boot; then
@@ -56,8 +56,8 @@ ovirt_boot_setup() {
         grub_dev_label="RootBackup"
     fi
 
-    # check that /boot mounted ok and find partition number for GRUB
-    get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN
+    # check that /boot mounted ok and find partition number for GRUB, $4 is to allow 0 as a partition number for grub
+    get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null)) disk partN y
     rc=$?
     if [ $rc -ne 0 -o $partN -lt 0 ]; then
       log "unable to determine Root partition"
@@ -217,7 +217,9 @@ ovirt_boot_setup "$live" "$bootparams"
 rc=$?
 if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then
     disable_firstboot
-    ovirt_store_firstboot_config
+    if [ "$OVIRT_ISCSI_ENABLED" != "y" ]; then
+        ovirt_store_firstboot_config
+    fi
     stop_log
 
     reboot
diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index 4d412ac..810d0e0 100755
--- a/scripts/ovirt-config-networking
+++ b/scripts/ovirt-config-networking
@@ -24,10 +24,12 @@ CONFIGURED_NIC=""
 VLAN_ID=""
 VL_ROOT=""
 
+if [[ -z "$ROOTDRIVE" && "$OVIRT_ISCSI_ENABLED" != "y" ]]; then
 # if local storage is not configured, then exit the script
-if ! is_local_storage_configured; then
-    printf "Local storage must be configured prior to configuring the management interface.\n\n"
-    exit 99
+    if [[ ! is_local_storage_configured && "$OVIRT_ISCSI_NETWORKING" != "y" ]] ; then
+        printf "Local storage must be configured prior to configuring the management interface.\n\n"
+        exit 99
+    fi
 fi
 
 # $1 - the variable name to set
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index ce9707c..c94c79d 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -624,7 +624,7 @@ perform_partitioning()
         parted "$BOOTDRIVE" -s "mklabel ${LABEL_TYPE}"
         parted "$BOOTDRIVE" -s "mkpartfs primary ext2 0M ${boot_size_si}M"
         reread_partitions "$BOOTDRIVE"
-        partboot="$BOOTDRIVE1"
+        partboot="${BOOTDRIVE}1"
         if [ ! -e "$partboot" ]; then
             partboot="${BOOTDRIVE}p1"
         fi
@@ -794,11 +794,26 @@ do_confirm()
         else
             return
         fi
+        # store networking config since it was created before storage was established for iscsi targets
+        if [ "$OVIRT_ISCSI_NETWORKING" == "y" ]; then
+            ovirt_store_config \
+        /etc/sysconfig/network-scripts/ifcfg* \
+        /etc/ntp.conf
+        fi
     done
 }
 
 do_iscsi_target()
 {
+if ! network_up ; then
+    printf "Networking must be configured prior to configuring an iscsi target.\n\n"
+    # allow network config without setting up storage first
+    augtool <<EOF
+set /files/etc/default/ovirt/OVIRT_ISCSI_NETWORK_CONFIG y
+EOF
+    exit 99
+fi
+
 while true; do
     OPTIONS="\"Target IP\" \"Target Port\"" #\"CHAP Username\" \"CHAP Password\""
     printf "\nPress Enter to leave option blank or Q to quit (default Target Port is 3260)\n"
diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index 1d4463b..34ad8df 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -326,7 +326,7 @@ mount_boot() {
        return 0
     fi
     mkdir -p /boot
-    mount LABEL=Root /boot
+    mount LABEL=Boot /boot
 }
 # stop any service which keeps /var/log busy
 # keep the list of services
@@ -865,23 +865,32 @@ get_part_info() {
     local drive_in="$1"
     local dev_var=$2
     local part_var=$3
+    local grub_dev=$4
     local devname_1 devname2 part_number
     local rc=0
 
-    eval $(readlink -f "$drive_in" |awk {'
-        print "devname_1=" substr($1,1,length($1)-1);
-        print "devname_2=" substr($1,1,length($1)-2);
-        part_number=substr($1,length($1),1);
-        print "part_number=" part_number;
-    }')
+    if [ -z "$grub_dev" ]; then
+        eval $(readlink -f "$drive_in" |awk {'
+            print "devname_1=" substr($1,1,length($1)-1);
+            print "devname_2=" substr($1,1,length($1)-2);
+            part_number=substr($1,length($1),1);
+            print "part_number=" part_number;
+        }')
+    else
+        eval $(readlink -f "$drive_in" |awk {'
+            print "devname_1=" substr($1,1,length($1)-1);
+            print "devname_2=" substr($1,1,length($1)-2);
+            part_number=substr($1,length($1),1); part_number--;
+            print "part_number=" part_number;
+        }')
+    fi
     rc=$?
 
-    if [[ "part_number" -lt 1 ]]; then
+    if [[ "$part_number" -lt 1 && "$grub_dev" != "y" ]]; then
         log "Partition number was invalid"
         return 2
     fi
 
-
     if [ -e ${devname_1} ]; then
         eval "${dev_var}"="${devname_1}"
     elif [ -e ${devname_2} ]; then
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]