Alan Pevec
2008-Nov-18 00:02 UTC
[Ovirt-devel] [PATCH ovirt-node] auto-install for standalone mode
each ovirt-config-* module is called with AUTO argument when all required boot parameters are specified --- scripts/ovirt-config-logging | 5 ++--- scripts/ovirt-config-networking | 6 +++--- scripts/ovirt-early | 13 ++++++++----- scripts/ovirt-firstboot | 6 ++++-- scripts/ovirt-functions | 13 +++++++++++++ 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index 2dd9d9c..4d75be7 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -129,9 +129,8 @@ function prompt_user { } -# check if we were called to attempt to default -# to remote logging -if [ "$1" = "default" ]; then +# AUTO for auto-install +if [ "$1" = "AUTO" ]; then if [ -z "$OVIRT_SYSLOG_SERVER" -o -z "$OVIRT_SYSLOG_PORT" ]; then printf "\nAttempting to locate remote syslog server..." find_srv syslog udp diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index 4ad8af0..0306bfb 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -92,8 +92,8 @@ function setup_menu PS3="Please select a network interface to configure:" } -if [ "$1" == "AUTO" ]; then - configure_interface $OVIRT_MGMT_IFACE AUTO +if [ "$1" == "AUTO" -a -n "$OVIRT_BOOTIF" ]; then + configure_interface $OVIRT_BOOTIF AUTO RESTART="Y" else setup_menu @@ -104,7 +104,7 @@ else case "$NIC" in "Save") RESTART="Y"; break ;; "Quit") exit 0; break ;; - *) configure_interface $NIC $IFACE_NUMBER ;; + *) configure_interface $NIC ;; esac setup_menu done diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 394fce5..d405de6 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -315,7 +315,7 @@ start() { # oVirt boot parameters # BOOTIF=<MAC> (appended by pxelinux) # ovirt_init=usb|scsi[:serial#] - # ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB + # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB # ovirt_local_boot # ovirt_standalone # pxelinux format: ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask> @@ -339,10 +339,11 @@ start() { # e.g. ovirt_init=usb:Generic_STORAGE_DEVICE_0000145418-0:0 ovirt_init - # ovirt_vol=BOOT_GB:SWAP_GB:INSTALL_GB:CONFIG_GB:LOGGING_GB + # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB # local partition sizes in GB ovirt_vol_boot- ovirt_vol_install+ ovirt_vol_swap+ ovirt_vol_root ovirt_vol_config ovirt_vol_logging @@ -387,7 +388,7 @@ start() { ;; ovirt_vol=*) i=${i#ovirt_vol=} - eval $(printf $i|awk -F: '{print "ovirt_vol_boot="$1; print "ovirt_vol_install="$2; print "ovirt_vol_config="$3; print "ovirt_vol_logging="$4;}') + eval $(printf $i|awk -F: '{print "ovirt_vol_boot="$1; ovirt_vol_swap="$2; print "ovirt_vol_root="$3; print "ovirt_vol_config="$4; print "ovirt_vol_logging="$5;}') ;; ovirt_local_boot*) ovirt_local_boot=1 @@ -424,12 +425,14 @@ start() { if [ -z "$ip_gateway" ]; then ip_gateway=$gateway fi + cat > $OVIRT_DEFAULTS <<EOF # configuration defaults from oVirt Node boot parameters OVIRT_BOOTIF=$bootif OVIRT_INIT=$ovirt_init OVIRT_VOL_BOOT=$ovirt_vol_boot -OVIRT_VOL_INSTALL=$ovirt_vol_install +OVIRT_VOL_SWAP=$ovirt_vol_swap +OVIRT_VOL_ROOT=$ovirt_vol_root OVIRT_VOL_CONFIG=$ovirt_vol_config OVIRT_VOL_LOGGING=$ovirt_vol_logging OVIRT_LOCAL_BOOT=$ovirt_local_boot diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 72f0557..39d5c86 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -31,9 +31,11 @@ start () { INTERACTIVE="Y" - if [ -n "$OVIRT_MGMT_IFACE" ]; then + if is_auto_install; then INTERACTIVE="N" - ./ovirt-config-networking AUTO + ovirt-config-networking AUTO + ovirt-config-storage AUTO + ovirt-config-logging AUTO fi if [ "$INTERACTIVE" == "Y" ]; then diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index bdb0629..5826933 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -26,6 +26,19 @@ is_standalone() { if is_managed; then return 1; else return 0; fi } +# is_auto_install +# return 0 if all required oVirt boot parameters are present +is_auto_install() { + test -n "$OVIRT_BOOTIF" \ + -a -n "$OVIRT_OVIRT_STANDALONE" \ + -a -n "$OVIRT_INIT" \ + -a -n "$OVIRT_VOL_BOOT" \ + -a -n "$OVIRT_VOL_SWAP" \ + -a -n "$OVIRT_VOL_ROOT" \ + -a -n "$OVIRT_VOL_CONFIG" \ + -a -n "$OVIRT_VOL_LOGGING" +} + # find_srv SERVICE PROTO # # reads DNS SRV record -- 1.5.6.5