Ricardo Marin Matinata
2010-Jul-21 18:27 UTC
[Ovirt-devel] [PATCH] RFC: Advanced Storage Configuration
This patch introduces the concept of an "Advanced Storage Configuration", specifically for automated installs (although it could be hooked into manual install), while preserving the original style of specifying LVs. It accomplishes the following: * Add an optional AppVG * Offer new optional LVs - Data2,Swap2 - as part of the new AppVG * Allows the specification of multiple disks, per VG The new syntax for ovirt_init, which includes the original one, is: virt_init=HOSTVGDISK1[,HOSTVGDISK2...][;APPVGDISK1[,APPVGDISK2...]] where DISK=[usb|scsi[:serial#]|/dev/...] The new syntax for ovirt_vol, which includes the original one, is: ovirt_vol=size[,{Swap|Data|Config|Logging|Data2|Swap2}][:size...] or simply ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB:SWAP2_MB:DATA2_MB Signed-off-by: Ricardo Marin Matinata <matinata at br.ibm.com> --- recipe/common-post.ks | 1 + scripts/ovirt-config-storage | 316 +++++++++++++++++++++++++++++++++--------- scripts/ovirt-early | 205 +++++++++++++++++++++++----- scripts/ovirt-functions | 17 +++ 4 files changed, 442 insertions(+), 97 deletions(-) diff --git a/recipe/common-post.ks b/recipe/common-post.ks index fed5b6b..c79e186 100644 --- a/recipe/common-post.ks +++ b/recipe/common-post.ks @@ -217,6 +217,7 @@ sed -i 's at NOT_OVIRT_FIRSTBOOT@$(if cat /proc/cmdline|grep -qv ovirt_firstboot; t mkdir -p /boot mkdir -p /config mkdir -p /data +mkdir -p /data2 mkdir -p /liveos echo "/dev/HostVG/Config /config ext3 defaults,noauto,noatime 0 0" >> /etc/fstab diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index 513a240..e3bb57b 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -30,6 +30,8 @@ default_config_size=5 default_logging_size=2048 # -1 indicates data partition should use remaining disk default_data_size=-1 +default_swap2_size=0 +default_data2_size=0 boot_min_size=50 root_min_size=256 config_min_size=5 @@ -123,6 +125,10 @@ check_partition_sizes() if [ "$DATA_SIZE" = -1 ]; then min_data_size=5 fi + local min_data2_size="$DATA2_SIZE" + if [ "$DATA_SIZE2" = -1 ]; then + min_data_size=5 + fi printf "\n" if [ "$OVIRT_ISCSI_ENABLED" = "y" ]; then @@ -131,7 +137,27 @@ check_partition_sizes() BOOT_NEED_SIZE="$BOOT_SIZE" else get_drive_size "$ROOTDRIVE" ROOTDRIVESPACE - get_drive_size "$HOSTVGDRIVE" HOSTVGDRIVESPACE + for drv in $HOSTVGDRIVE; do + get_drive_size "$drv" DRIVESPACE + if [ -n "${HOSTVGDRIVESPACE}" ]; then + HOSTVGDRIVESPACE=$(echo "scale=0;" \ + "$HOSTVGDRIVESPACE + $DRIVESPACE" | bc -l) + else + HOSTVGDRIVESPACE=$DRIVESPACE + fi + done + if [ -n "${APPVGDRIVE}" ]; then + for drv in $APPVGDRIVE; do + get_drive_size "$drv" DRIVESPACE + if [ -n "${APPVGDRIVESPACE}" ]; then + APPVGDRIVESPACE=$(echo "scale=0;" \ + "$APPVGDRIVESPACE + $DRIVESPACE" | bc -l) + else + APPVGDRIVESPACE=$DRIVESPACE + fi + done + APPVG_NEED_SIZE=$(echo "scale=0; $SWAP2_SIZE + $min_data2_size" | bc -l) + fi ROOT_NEED_SIZE=$(echo "scale=0; $ROOT_SIZE * 2"| bc -l) HOSTVG_NEED_SIZE=$(echo "scale=0;" \ "$SWAP_SIZE + $CONFIG_SIZE + $LOGGING_SIZE + $min_data_size" | bc -l) @@ -141,6 +167,13 @@ check_partition_sizes() ROOT_NEED_SIZE=$(echo "scale=0; $ROOT_SIZE * 2 + $HOSTVG_NEED_SIZE"| bc -l) else drive_list="ROOT HOSTVG" + eval $(printf $HOSTVGDRIVE |awk '{ print "DRIVE="$1; }') + if [ "$ROOTDRIVE" = "$DRIVE" ]; then + HOSTVGDRIVESPACE=$(echo "scale=0; $HOSTVGDRIVESPACE - $ROOT_NEED_SIZE"| bc -l) + fi + fi + if [ -n "${APPVGDRIVE}" ]; then + drive_list="${drive_list} APPVG" fi fi @@ -489,22 +522,33 @@ EOF return ${is_negative-0} } -#Check for an existing HostVG on any device on the system. -# Return 0 if there is a HostVG found, unless only one found is on $1 +#Check for an existing VG on any device on the system. +# Return 0 if there is a VG found, unless the only one found is on $1 # Return 1 if no HostVG found or only found on $1 # XXX # from check_partition_sizes(): # if [ "$OVIRT_ISCSI_ENABLED" != "y" ]; then check_existing_hostvg() { - local install_dev="$1" + local install_dev+ local dev+ for dev in $1; do + if [ -n "${install_dev}" ]; then + install_dev="${install_dev}+|${dev}" + else + install_dev="${dev}" + fi + done local devices_var=$2 + local vgname+ { [ -n $3 ] && vgname="$3"; } || vgname="HostVG" + if [ -z "$install_dev" ]; then devices="$(pvs --separator="${TAB}" -o pv_name,vg_name --noheadings | \ - grep "HostVG" | cut -f1)" + grep "${vgname}" | cut -f1)" else devices="$(pvs --separator="${TAB}" -o pv_name,vg_name --noheadings | \ - grep -v "${install_dev}" | grep "HostVG" | cut -f1)" + egrep -v "${install_dev}" | grep "${vgname}" | cut -f1)" fi rc=1 if [ -n "$devices" ]; then @@ -531,15 +575,29 @@ check_existing_hostvg() # - remove LVM volumes and groups wipe_lvm_on_disk() { - local dev=${1-"$HOSTVGDRIVE"} + local devs=${1-"$HOSTVGDRIVE"} + local query1+ local query2 unmount_logging - local part_delim="p" - if [[ "$dev" =~ "/dev/sd" ]]; then - part_delim="" - fi - for vg in $(pvs -o vg_uuid --noheadings "$dev" "$dev${dev_delim}[0-9]"* 2>/dev/null|sort -u); do + for d in $devs; do + local part_delim="p" + if [[ "$d" =~ "/dev/sd" ]]; then + part_delim="" + fi + if [ -n "${query1}" ]; then + query1="${query1} ${d} ${d}${part_delim}[0-9]*" + else + query1="${d} ${d}${part_delim}[0-9]*" + fi + if [ -n "${query2}" ]; then + query2="${query2}+|${d}${part_delim}[0-9]+|${d}" + else + query2="${d}${part_delim}[0-9]+|${d}" + fi + done + for vg in $(pvs -o vg_uuid --noheadings "$query1" 2>/dev/null|sort -u); do if pvs -o pv_name,vg_uuid --noheadings | \ - grep "$vg" | egrep -v -q "${dev}${part_delim}[0-9]+|${dev} " 2>/dev/null; then + grep "$vg" | egrep -v -q "${query2} " 2>/dev/null; then log "The volume group \"$vg\" spans multiple disks." log "This operation cannot complete. Please manually" log "cleanup the storage using standard disk tools." @@ -569,48 +627,52 @@ reread_partitions() create_hostvg() { - log "Creating LVM partition" - - if [ "$ROOTDRIVE" = "$HOSTVGDRIVE" ]; then - parted "$HOSTVGDRIVE" -s "mkpart primary ext2 ${RootBackup_end}M -1" - hostvgpart="3" - elif [ "$BOOTDRIVE" = "$HOSTVGDRIVE" ]; then - parted "$HOSTVGDRIVE" -s "mkpart primary ext2 ${boot_size_si} -1" - hostvgpart="2" - # FIXME : set for gtpsync/parted compat for now - ROOTDRIVE=$BOOTDRIVE - else - parted "$HOSTVGDRIVE" -s "mkpart primary ext2 0M -1" - hostvgpart="1" - fi - log "Toggling LVM on" - parted "$HOSTVGDRIVE" -s "set $hostvgpart lvm on" - parted "$ROOTDRIVE" -s "print" - udevadm settle 2> /dev/null || udevsettle - reread_partitions "$HOSTVGDRIVE" + log "Creating LVM partition(s) for HostVG" + local drv+ for drv in $HOSTVGDRIVE; do + if [ "$ROOTDRIVE" = "$drv" ]; then + parted "$drv" -s "mkpart primary ext2 ${RootBackup_end}M -1" + hostvgpart="3" + elif [ "$BOOTDRIVE" = "$drv" ]; then + parted "$drv" -s "mkpart primary ext2 ${boot_size_si} -1" + hostvgpart="2" + # FIXME : set for gtpsync/parted compat for now + ROOTDRIVE=$BOOTDRIVE + else + parted "$drv" -s "mkpart primary ext2 0M -1" + hostvgpart="1" + fi + log "Toggling LVM on" + parted "$drv" -s "set $hostvgpart lvm on" + parted "$ROOTDRIVE" -s "print" + udevadm settle 2> /dev/null || udevsettle + reread_partitions "$drv" + + # sync GPT to the legacy MBR partitions + if [ "${OVIRT_INSTALL_ROOT}" = "y" -a ${hostvgpart} -gt 1 ]; then + if [ "gpt" = "$LABEL_TYPE" ]; then + log "Running gptsync to create legacy mbr" + gptsync "$ROOTDRIVE" + fi + fi - # sync GPT to the legacy MBR partitions - if [ "${OVIRT_INSTALL_ROOT}" = "y" ]; then - if [ "gpt" = "$LABEL_TYPE" ]; then - log "Running gptsync to create legacy mbr" - gptsync "$ROOTDRIVE" + partpv="${drv}${hostvgpart}" + if [ ! -e "$partpv" ]; then + # e.g. /dev/cciss/c0d0p2 + partpv="${drv}p${hostvgpart}" fi - fi + log "Creating physical volume" + if [ ! -e "$partpv" ]; then + log "$partpv is not available!" + exit 1 + fi + dd if=/dev/zero of="${partpv}" bs=1024k count=1 + pvcreate -ff -y "${partpv}" + physical_vols="${physical_vols} ${partpv}" + done - partpv="${HOSTVGDRIVE}${hostvgpart}" - if [ ! -e "$partpv" ]; then - # e.g. /dev/cciss/c0d0p2 - partpv="${HOSTVGDRIVE}p${hostvgpart}" - fi - log "Creating physical volume" - if [ ! -e "$partpv" ]; then - log "$partpv is not available!" - exit 1 - fi - dd if=/dev/zero of="${partpv}" bs=1024k count=1 - pvcreate -ff -y "${partpv}" log "Creating volume group" - vgcreate /dev/HostVG "${partpv}" + vgcreate /dev/HostVG "${physical_vols}" if [ "$SWAP_SIZE" -gt 0 ]; then log "Creating swap partition" @@ -665,9 +727,75 @@ create_hostvg() log "Mounting data partition" mount_data fi - log "Completed!" + log "Completed HostVG!" + +} + +create_appvg() +{ + log "Creating LVM partition(s) for AppVG" + local drv+ for drv in $APPVGDRIVE; do + wipe_partitions "$drv" + reread_partitions "$drv" + log "Labeling Drive: $drv" + parted "$drv" -s "mklabel ${LABEL_TYPE}" + parted "$drv" -s "mkpart primary ext2 0M -1" + appvgpart="1" + log "Toggling LVM on" + parted "$drv" -s "set $appvgpart lvm on" + parted "$drv" -s "print" + udevadm settle 2> /dev/null || udevsettle + reread_partitions "$drv" + + partpv="${drv}${appvgpart}" + if [ ! -e "$partpv" ]; then + # e.g. /dev/cciss/c0d0p2 + partpv="${drv}p${appvgpart}" + fi + log "Creating physical volume" + if [ ! -e "$partpv" ]; then + log "$partpv is not available!" + exit 1 + fi + dd if=/dev/zero of="${partpv}" bs=1024k count=1 + pvcreate -ff -y "${partpv}" + physical_vols="${physical_vols} ${partpv}" + done + + log "Creating volume group" + vgcreate /dev/AppVG "${physical_vols}" + + if [ "$SWAP2_SIZE" -gt 0 ]; then + log "Creating swap2 partition" + lvcreate --name Swap2 --size ${SWAP2_SIZE}M /dev/AppVG + mkswap -L "SWAP2" /dev/AppVG/Swap2 + echo "/dev/AppVG/Swap2 swap swap defaults 0 0" >> /etc/fstab + fi + + local use_data=1 + if [ "$DATA2_SIZE" -eq -1 ]; then + log "Creating data2 partition with remaining free space" + lvcreate --name Data2 -l 100%FREE /dev/AppVG + use_data=0 + elif [ "$DATA2_SIZE" -gt 0 ]; then + log "Creating data2 partition" + lvcreate --name Data2 --size ${DATA2_SIZE}M /dev/AppVG + use_data=0 + fi + + if [ "$use_data" = 0 ]; then + mke2fs -j /dev/AppVG/Data2 -L "DATA" + tune2fs -c 0 -i 0 /dev/AppVG/Data2 + echo "/dev/AppVG/Data2 /data2 ext3 defaults,noatime 0 0" >> /etc/fstab + fi + + if [ "$use_data" = 0 ]; then + log "Mounting data2 partition" + mount_data2 + fi + log "Completed AppVG!" - stop_log } perform_partitioning() @@ -688,6 +816,7 @@ perform_partitioning() log "Removing old LVM partitions" wipe_lvm_on_disk "$HOSTVGDRIVE" + [ -n ${APPVGDRIVE} ] && wipe_lvm_on_disk "$APPVGDRIVE" wipe_lvm_on_disk "$ROOTDRIVE" # begin critical section @@ -746,11 +875,17 @@ perform_partitioning() tune2fs -c 0 -i 0 "${partrootbackup}" fi - if [ "$ROOTDRIVE" != "$HOSTVGDRIVE" ]; then - log "Labeling Drive: $HOSTVGDRIVE" - parted "$HOSTVGDRIVE" -s "mklabel ${LABEL_TYPE}" - fi + for drv in $HOSTVGDRIVE; do + if [ "$ROOTDRIVE" != "$drv" ]; then + wipe_partitions "$drv" + reread_partitions "$drv" + log "Labeling Drive: $drv" + parted "$drv" -s "mklabel ${LABEL_TYPE}" + fi + done create_hostvg + [ -n ${APPVGDRIVE} ] && create_appvg + stop_log } do_confirm() @@ -900,6 +1035,19 @@ fi done } +cross_check_host_app() +{ +for hdrv in $HOSTVGDRIVE; do + for adrv in $APPVGDRIVE; do + if [ "${hdrv}" = "${adrv}" ]; then + # Skip disk partitioning, AppVGs overlaps with HostVGs + return 1 + fi + done +done +return 0 +} + MEM_SIZE_MB=$(awk '/MemTotal:/ { print $2 }' /proc/meminfo) case $MEM_SIZE_MB in ''|*[^0-9]*) die failed to get system memory size;; @@ -931,16 +1079,48 @@ 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} DATA_SIZE=${OVIRT_VOL_DATA_SIZE:-$default_data_size} +SWAP2_SIZE=${OVIRT_VOL_SWAP2_SIZE:-$default_swap2_size} +DATA2_SIZE=${OVIRT_VOL_DATA2_SIZE:-$default_data2_size} if [ -n "$OVIRT_INIT" ]; then # if present, use the drive selected with 'ovirt_init' boot parameter # setting these the same until kernel cmdline argument implemented - DRIVE="$(translate_multipath_device "$OVIRT_INIT")" - ROOTDRIVE="$DRIVE" - HOSTVGDRIVE="$DRIVE" + eval $(printf $OVIRT_INIT |awk '{ print "DRIVE="$1; }') + ROOTDRIVE="$(translate_multipath_device "$DRIVE")" + for drv in $OVIRT_INIT; do + DRIVE="$(translate_multipath_device "$drv")" + if [ -n "$HOSTVGDRIVE" ]; then + HOSTVGDRIVE="$HOSTVGDRIVE $DRIVE" + else + HOSTVGDRIVE="$DRIVE" + fi + done + # Is this really needed ?? get_drive_size "$ROOTDRIVE" ROOTDRIVESPACE fi +if [ -n "$OVIRT_INITAPP" ]; then + if [ ${SWAP2_SIZE} -ne 0 -o ${DATA2_SIZE} -ne 0 ]; then + for drv in $OVIRT_INITAPP; do + DRIVE="$(translate_multipath_device "$drv")" + if [ -n "$APPVGDRIVE" ]; then + APPVGDRIVE="$APPVGDRIVE $DRIVE" + else + APPVGDRIVE="$DRIVE" + fi + done + cross_check_host_app || { + log "Skip disk partitioning, AppVGs disks overlaps with HostVGs"; + exit 1; + } + fi +else + { [ ${SWAP2_SIZE} -ne 0 ] || [ $DATA2_SIZE -ne 0 ]; } && { + log "Missing device parameter for AppVG: unable to partition any disk"; + exit 2; + } +fi + # if the node is Fedora then use GPT, otherwise use MBR if [ -f /etc/fedora-release ]; then LABEL_TYPE="gpt" @@ -951,11 +1131,21 @@ fi if [ "$1" = "AUTO" ]; then log "Beginning automatic disk partitioning." if [ -n "$OVIRT_INIT" ]; then - # do not format if HostVG exists on selected disk... - check_existing_hostvg "$HOSTVGDRIVE" + # do not format if HostVG/AppVG exists on selected disk(s)... + # CHECK: is check_existing_hostvg really doing the above ? + # Rather it seems to allow going through with the + # overwrite, if the VG is restricted to the specified + # disk(s), as opposed to the stated above, which expects + # halting if the VG simply exists in the spefified disk(s) + check_existing_hostvg "$HOSTVGDRIVE" devs "HostVG" existingHostVG=$? + existingAppVG=1 + if [ -n "$APPVGDRIVE" ]; then + check_existing_hostvg "$APPVGDRIVE" devs "AppVG" + existingAppVG=$? + fi # ... unless overridden by ovirt_firstboot parameter - if is_firstboot || [ $existingHostVG -ne 0 ]; then + if is_firstboot || [ $existingHostVG -ne 0 -a $existingAppVG -ne 0 ]; then if check_partition_sizes; then log "Partitioning hard disk..." perform_partitioning diff --git a/scripts/ovirt-early b/scripts/ovirt-early index 6dc8bee..23198b1 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -205,8 +205,10 @@ start_ovirt_early () { # BOOTIF=eth* e.g. BOOTIF=eth0 - use given interface bootif - # ovirt_init=[usb|scsi[:serial#]|/dev/...] - # local installation target disk + # ovirt_init=HOSTVGDISK1[,HOSTVGDISK2...][;APPVGDISK1[,APPVGDISK2...]] + # where DISK=[usb|scsi[:serial#]|/dev/...] + # local installation target disks + # Allow specification of multiple disks per VG # usb|scsi - select disk type, as reported by udev ID_BUS # serial# - select exact disk using serial number, as reported by # udev ID_SERIAL @@ -215,9 +217,13 @@ start_ovirt_early () { # (for cases when HAL doesn't handle it) # w/o value - grab the first disk (/dev/?da) init+ initapp - # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB + # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB:SWAP2_MB:DATA2_MB + # or + # ovirt_vol=size[,{Swap|Data|Config|Logging|Data2|Swap2}][:size...] # local partition sizes in MB + # LVs ending in 2 go to AppVG, all the others fall into HostVG vol_boot_size vol_swap_size vol_root_size@@ -228,6 +234,11 @@ start_ovirt_early () { # or a specific positive number in MB vol_data_size + # swap2 and data2 will be placed into AppVG, 0 disables, data2 + # can be -1 or a positive number in MB for each + vol_swap2_size+ vol_data2_size+ # ovirt_upgrade # install/update oVirt Node image on the local installation target disk upgrade@@ -320,46 +331,172 @@ start_ovirt_early () { esac ;; ovirt_init*) - i=${i#ovirt_init} - if [ -n "$i" ]; then - # resolve to disk device - case "$i" in - =scsi*) - bus=scsi - i=${i#=scsi} - serial=${i#:} - ;; - =usb*) - bus=usb - i=${i#=usb} - serial=${i#:} - ;; - =/dev/*) - bus- serial- i=${i#=} - init=$(ls -1 "$i" 2>/dev/null | head -n1) - ;; - *) - bus- serial- init- ;; - esac - if [ -n "$bus" ]; then - init=$(find_disk $bus $serial) - fi + i=${i#ovirt_init=} + eval $(printf $i|awk -F\; '{ print "hostvgdisks="$1; print "appvgdisks="$2; }') + # Look into HostVG disks + if [ -n "$hostvgdisks" ]; then + oldIFS="$IFS" + IFS=, + init+ for d in $hostvgdisks; do + # resolve to disk device + case "$d" in + scsi*) + bus=scsi + d=${d#=scsi} + serial=${d#:} + ;; + usb*) + bus=usb + d=${d#=usb} + serial=${d#:} + ;; + /dev/*) + bus+ serial+ d=${d#=} + if [ -n "$init" ]; then + init="$init $(ls -1 "$d" 2>/dev/null | head -n1)" + else + init=$(ls -1 "$d" 2>/dev/null | head -n1) + fi + ;; + *) + bus+ serial+ ;; + esac + if [ -n "$bus" ]; then + if [ -n "$init" ]; then + init="$init $(IFS="$oldIFS" find_disk $bus $serial)" + else + init=$(IFS="$oldIFS" find_disk $bus $serial) + fi + fi + done + IFS="$oldIFS" else # 'ovirt_init' without value: grab first disk init=$(ls -1 /dev/?da 2>/dev/null |head -n1) fi + # Look into AppVG disks + if [ -n "$appvgdisks" ]; then + oldIFS="$IFS" + IFS=, + bus+ serial+ for d in $appvgdisks; do + # resolve to disk device + case "$d" in + scsi*) + bus=scsi + d=${d#=scsi} + serial=${d#:} + ;; + usb*) + bus=usb + d=${d#=usb} + serial=${d#:} + ;; + /dev/*) + bus+ serial+ d=${d#=} + if [ -n "$initapp" ]; then + initapp="$initapp $(ls -1 "$d" 2>/dev/null | head -n1)" + else + initapp=$(ls -1 "$d" 2>/dev/null | head -n1) + fi + ;; + *) + bus+ serial+ ;; + esac + if [ -n "$bus" ]; then + if [ -n "$initapp" ]; then + initapp="$initapp $(IFS="$oldIFS" find_disk $bus $serial)" + else + initapp=$(IFS="$oldIFS" find_disk $bus $serial) + fi + fi + done + IFS="$oldIFS" + fi if [ -z "$init" ]; then log "Selected disk $i is not valid." fi ;; ovirt_vol=*) i=${i#ovirt_vol=} - eval $(printf $i|awk -F: '{print "vol_boot_size="$1; print "vol_swap_size="$2; print "vol_root_size="$3; print "vol_config_size="$4; print "vol_logging_size="$5; print "vol_data_size="$6;}') + eval $(printf $i|awk -F: '{ print "lv1="$1; print "lv2="$2; print "lv3="$3; print "lv4="$4; print "lv5="$5; print "lv6="$6; print "lv7="$7; print "lv8="$8; }') + # Reads each provided LV size and assign them + for p in 1 2 3 4 5 6 7 8; do + var=lv$p + size+ lv+ if [ -n "${!var}" ]; then + eval $(printf ${!var}|awk -F, '{ print "size="$1; print "lv="$2; }') + if [ -n "${size}" ]. then + case "${lv}" in + Boot) + vol_boot_size=$size + ;; + Swap) + vol_swap_size=$size + ;; + Root) + vol_root_size=$size + ;; + Config) + vol_config_size=$size + ;; + Logging) + vol_logging_size=$size + ;; + Data) + vol_data_size=$size + ;; + Swap2) + vol_swap2_size=$size + ;; + Data2) + vol_data2_size=$size + ;; + *) + ## This is here to preserve old styled syntax (in order) + ## BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB:SWAP2_MB:DATA2_MB + case "$p" in + 1) + vol_boot_size=$size + ;; + 2) + vol_swap_size=$size + ;; + 3) + vol_root_size=$size + ;; + 4) + vol_config_size=$size + ;; + 5) + vol_logging_size=$size + ;; + 6) + vol_data_size=$size + ;; + 7) + vol_swap2_size=$size + ;; + 8) + vol_data2_size=$size + ;; + esac + ;; + esac + fi + fi + done ;; ovirt_upgrade* |ovirt_local_boot*) upgrade=1 @@ -455,7 +592,7 @@ start_ovirt_early () { ip_gateway=$gateway fi # save boot parameters as defaults for ovirt-config-* - params="bootif init vol_boot_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot runtime_mode" + params="bootif init initapp vol_boot_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size vol_swap2_size vol_data2_size upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot runtime_mode" # mount /config unless firstboot is forced if [ "$firstboot" != "1" ]; then mount_config diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index 7b95ea8..5c574f7 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -430,6 +430,23 @@ mount_data() { fi } +mount_data2() { + if grep -q " /data2 ext3" /proc/mounts; then + return 0 + fi + + if [ -e /dev/AppVG/Data2 ] ; then + mkdir -p /data2 + mount /data2 + + return 0 + else + # /data2 is not available + printf "\nThe data2 partion has not been created. Please create it at the main menu.\n" + return 1 + fi +} + # augtool wrapper # workaround for bind-mounted files # see https://fedorahosted.org/augeas/ticket/32 -- 1.6.6.1
Apparently Analagous Threads
- [PATCH node] Handle space in storage wwid
- RESEND: [PATCH node 1/3] enables ability for a common shared root
- [PATCH node] add ability to select separate disks for Root and HostVG in o-c-storage
- [PATCH node] First draft of replacing some of the ovirt-config-* scripts with python equivalents.
- [PATCH] RFC: Encrypted swap support