Joey Boggs
2010-May-10 15:19 UTC
[Ovirt-devel] [PATCH node] RESEND: fix iscsi installation problems
This patch fixes both local installation and iscsi installation issues --- 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 9593905..15066f7 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -40,7 +40,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 @@ -62,8 +62,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" @@ -228,7 +228,9 @@ fi 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 9b37035..df36752 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -642,7 +642,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 @@ -817,11 +817,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 b0255ce..73deaa2 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
Joey Boggs
2010-May-10 15:23 UTC
[Ovirt-devel] [PATCH node] RESEND: fix iscsi installation problems
On 05/10/2010 11:19 AM, Joey Boggs wrote:> This patch fixes both local installation and iscsi installation issues > --- > 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 9593905..15066f7 100755 > --- a/scripts/ovirt-config-boot > +++ b/scripts/ovirt-config-boot > @@ -40,7 +40,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 > @@ -62,8 +62,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" > @@ -228,7 +228,9 @@ fi > 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 9b37035..df36752 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -642,7 +642,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 > @@ -817,11 +817,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 b0255ce..73deaa2 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 >This one is over a month old and without it prevents local installation. I'll push this later today if there's no negative feedback
Reasonably Related Threads
- [PATCH node] fix iscsi installation problems
- [PATCH node][REPOST 1/2] Fix uninstall to detect and cleanup correct partitions
- [PATCH node][RFC] Fix uninstall to detect and cleanup correct partitions
- [PATCH node] Handle space in storage wwid
- [PATCH node] Fix uninstall to detect and cleanup correct partitions