Alan Pevec
2008-Dec-10 22:56 UTC
[Ovirt-devel] [PATCH node] simplify autoinstall condition
If minimal boot time config parameters are specified, autoinstall is performed. Minimum are BOOTIF for choosing management NIC (IPv4 DHCP is assumed) and ovirt_init to select local disk drive to install LVM partitions (default volume sizes are used if ovirt_vol parameter is missing) --- scripts/ovirt-config-storage | 3 +-- scripts/ovirt-firstboot | 7 ++++++- scripts/ovirt-functions | 13 ------------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index e2ddec1..12091db 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -270,10 +270,9 @@ ROOT_SIZE=${OVIRT_VOL_ROOT_SIZE:-$default_root_size} CONFIG_SIZE=${OVIRT_VOL_CONFIG_SIZE:-$default_config_size} LOGGING_SIZE=${OVIRT_VOL_LOGGING_SIZE:-$default_logging_size} +DRIVE=$OVIRT_INIT if [ "$1" == "AUTO" ]; then - # In "AUTO" mode, OVIRT_INIT should be defined in the environment. - DRIVE=$OVIRT_INIT check_partition_sizes printf "Partitioning hard disk..." perform_partitioning diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 8189864..e422774 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -35,7 +35,12 @@ start () plymouth --quit plymouth --wait - if is_auto_install; then + if [ -n "$OVIRT_BOOTIF" -a -n "$OVIRT_INIT" ] ; then + # perform autoinstall if minimal parameters are present: + # networking - OVIRT_BOOTIF, management NIC + # if other ip bootparams are not specified, IPv4 DHCP is assumed + # storage - OVIRT_INIT, local disk to use + # if ovirt_vol is not specified, default volume sizes are set ovirt-config-networking AUTO newrole -r system_r -t virtd_t -- -c 'ovirt-config-storage AUTO' ovirt-config-logging AUTO diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index c0ebc3a..3196d4b 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -26,19 +26,6 @@ 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_SIZE" \ - -a -n "$OVIRT_VOL_SWAP_SIZE" \ - -a -n "$OVIRT_VOL_ROOT_SIZE" \ - -a -n "$OVIRT_VOL_CONFIG_SIZE" \ - -a -n "$OVIRT_VOL_LOGGING_SIZE" -} - # find_srv SERVICE PROTO # # reads DNS SRV record -- 1.6.0.4
Alan Pevec
2008-Dec-11 16:18 UTC
[Ovirt-devel] [PATCH node] simplify autoinstall condition
Autoinstall is performed when required boot parameters are specified: - BOOTIF=link|eth*|01-11-22-33-44-55-66 for choosing management NIC (IPv4 DHCP is assumed) - ovirt_init=usb|scsi to select a local disk drive to install LVM volumes if ovirt_vol parameter is missing, default volume sizes are used, BOOT 50MB SWAP 2 * RAM size ROOT 256MB CONFIG 5MB LOGGING 256MB DATA rest of the disk equivalent is ovirt_vol=50::256:5:256 --- scripts/ovirt-config-storage | 5 ++--- scripts/ovirt-firstboot | 7 ++++++- scripts/ovirt-functions | 13 ------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index e2ddec1..c6b6b61 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -262,7 +262,7 @@ case $MEM_SIZE in ''|*[^0-9]*) die failed to get system memory size;; esac -MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024" | bc -l) +MEM_SIZE=$(echo "scale=0; $MEM_SIZE / 1024 * 2" | bc -l) SWAP_SIZE=${OVIRT_VOL_SWAP_SIZE:-$MEM_SIZE} BOOT_SIZE=${OVIRT_VOL_BOOT_SIZE:-$default_boot_size} @@ -270,10 +270,9 @@ ROOT_SIZE=${OVIRT_VOL_ROOT_SIZE:-$default_root_size} CONFIG_SIZE=${OVIRT_VOL_CONFIG_SIZE:-$default_config_size} LOGGING_SIZE=${OVIRT_VOL_LOGGING_SIZE:-$default_logging_size} +DRIVE=$OVIRT_INIT if [ "$1" == "AUTO" ]; then - # In "AUTO" mode, OVIRT_INIT should be defined in the environment. - DRIVE=$OVIRT_INIT check_partition_sizes printf "Partitioning hard disk..." perform_partitioning diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot index 8189864..eb22d07 100755 --- a/scripts/ovirt-firstboot +++ b/scripts/ovirt-firstboot @@ -35,7 +35,12 @@ start () plymouth --quit plymouth --wait - if is_auto_install; then + if [ -n "$OVIRT_BOOTIF" -a -n "$OVIRT_INIT" ] ; then + # perform autoinstall if following parameters are present: + # networking - OVIRT_BOOTIF, management NIC + # if other ip bootparams are not specified, IPv4 DHCP is assumed + # storage - OVIRT_INIT, local disk to use + # if ovirt_vol is not specified, default volume sizes are set ovirt-config-networking AUTO newrole -r system_r -t virtd_t -- -c 'ovirt-config-storage AUTO' ovirt-config-logging AUTO diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index 79081b5..7f4c205 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -26,19 +26,6 @@ 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_SIZE" \ - -a -n "$OVIRT_VOL_SWAP_SIZE" \ - -a -n "$OVIRT_VOL_ROOT_SIZE" \ - -a -n "$OVIRT_VOL_CONFIG_SIZE" \ - -a -n "$OVIRT_VOL_LOGGING_SIZE" -} - # find_srv SERVICE PROTO # # reads DNS SRV record -- 1.6.0.4