[Ovirt-devel] [PATCH node 1/3] Enables ability to have a common shared root

Mike Burns mburns at redhat.com
Thu Apr 1 02:58:50 UTC 2010


On Wed, 2010-03-31 at 22:20 -0400, Joey Boggs wrote:
> ---
>  scripts/ovirt-config-boot    |   13 +++++++-
>  scripts/ovirt-config-storage |   73 +++++++++++++++++++++++++----------------
>  2 files changed, 56 insertions(+), 30 deletions(-)
> 
> diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
> index d545878..8cc127b 100755
> --- a/scripts/ovirt-config-boot
> +++ b/scripts/ovirt-config-boot
> @@ -29,6 +29,12 @@ ovirt_boot_setup() {
>      local disk2
>      local partN=-1
>      log "installing the image."
> +
> +    if [ "$OVIRT_ROOT_INSTALL" == "n" ]; then
> +        log "done."
> +        return
> +    fi
> +
>      local found_boot=false
>      if findfs LABEL=Boot 2>&1 >/dev/null ; then
>          found_boot=true
> @@ -212,7 +218,12 @@ if [ -z "$doreboot" ]; then
>  fi
>  
>  start_log
> -ovirt_boot_setup "$live" "$bootparams"
> +if [ "$OVIRT_ROOT_INSTALL" =="n" ]; then
> +    log "done."
> +    return
> +else
> +    ovirt_boot_setup "$live" "$bootparams"
> +fi
>  rc=$?
>  if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then
>      disable_firstboot
> diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
> index 8d59a6b..aec3447 100755
> --- a/scripts/ovirt-config-storage
> +++ b/scripts/ovirt-config-storage
> @@ -357,6 +357,22 @@ do_configure()
>          printf "\n\nPlease select the disk to use for the Root.\n\n"
>          ROOTDRIVE=$(get_dev_name) || return 0
>          get_drive_size "$ROOTDRIVE" ROOTDRIVESPACE
> +        if ask_yes_or_no "Will Root be shared with other nodes ([Y]es/[N]o)?"; then
> +            OVIRT_SHARED_ROOT="y"
> +            if ask_yes_or_no "Partition and install Root?"; then
> +                OVIRT_ROOT_INSTALL="y"
> +            else
> +                OVIRT_ROOT_INSTALL="n"
> +            fi
> +        else
> +            OVIRT_SHARED_ROOT="n"
> +            OVIRT_ROOT_INSTALL="y"
> +        fi
> +
> +    augtool <<EOF
> +        set /files$OVIRT_DEFAULTS/OVIRT_SHARED_ROOT $OVIRT_SHARED_ROOT
> +        set /files$OVIRT_DEFAULTS/OVIRT_ROOT_INSTALL $OVIRT_ROOT_INSTALL
> +EOF
>  
>          printf "\n\nPlease select the disk to use for the HostVG.\n\n"
>          HOSTVGDRIVE=$(get_dev_name) || return 0
> @@ -402,6 +418,8 @@ do_configure()
>      if [ "$OVIRT_ISCSI_ENABLED" == "y" ]; then
>          partlist="boot" # swap root config logging data"
>          local space_left=$BOOTDRIVESPACE
> +    elif [ "$OVIRT_ROOT_INSTALL" == "n" ]; then
> +        partlist="swap config logging data"
>      else
>          partlist="swap root config logging data"
>      fi
> @@ -635,37 +653,32 @@ perform_partitioning()
>          return
>      fi
>  
> -    log "Starting partitioning of $ROOTDRIVE"
> -    log "Partitioning drive: $ROOTDRIVE"
> - # FIXME: save a backup copy, just in case?
> -    log "Wiping old boot sector"
> -    dd if=/dev/zero of=$ROOTDRIVE bs=1024K count=1
> -    reread_partitions $ROOTDRIVE
> -    partprobe -s $ROOTDRIVE
> -    log "Labeling Drive: $ROOTDRIVE"
> -    parted $ROOTDRIVE -s "mklabel ${LABEL_TYPE}"
> +    if [ "$OVIRT_ROOT_INSTALL" == "y" ]; then
> +        log "Starting partitioning of $ROOTDRIVE"
> +        log "Partitioning drive: $ROOTDRIVE"
> +     # FIXME: save a backup copy, just in case?
> +        log "Wiping old boot sector"
> +        dd if=/dev/zero of=$ROOTDRIVE bs=1024K count=1
> +        blockdev --rereadpt $ROOTDRIVE
	^^ This should be a call to reread_partitions

> +        partprobe -s $ROOTDRIVE
> +        log "Labeling Drive: $ROOTDRIVE"
> +        parted $ROOTDRIVE -s "mklabel ${LABEL_TYPE}"
> +        log "Creating Root and RootBackup Partitions"
> +        let RootBackup_end=${ROOT_SIZE}*2
> +        parted $ROOTDRIVE -s "mkpart primary ext2 0M ${ROOT_SIZE}M"
> +        parted $ROOTDRIVE -s "mkpart primary ext2 ${ROOT_SIZE}M ${RootBackup_end}M"
> +        # sleep to ensure filesystems are created before continuing
> +        sleep 10
> +        mke2fs ${ROOTDRIVE}1 -L Root
> +        mke2fs ${ROOTDRIVE}2 -L RootBackup
> +        tune2fs -c 0 -i 0 ${ROOTDRIVE}1
> +        tune2fs -c 0 -i 0 ${ROOTDRIVE}2

	I think we need to check whether the partitions are ${ROOTDRIVE}1 or
${ROOTDRIVE}p1 here.  See code around partroot and partrootbackup below

> +    fi
>  
>      if [ $ROOTDRIVE != $HOSTVGDRIVE ]; then
>          log "Labeling Drive: $HOSTVGDRIVE"
>          parted $HOSTVGDRIVE -s "mklabel ${LABEL_TYPE}"
>      fi
> -    log "Creating Root and RootBackup Partitions"
> -    let RootBackup_end=${ROOT_SIZE}*2
> -    parted $ROOTDRIVE -s "mkpart primary ext2 0M ${ROOT_SIZE}M"
> -    parted $ROOTDRIVE -s "mkpart primary ext2 ${ROOT_SIZE}M ${RootBackup_end}M"
> -    reread_partitions $ROOTDRIVE
> -    partroot=${ROOTDRIVE}1
> -    partrootbackup=${ROOTDRIVE}2
> -    if [ ! -e $partroot ]; then
> -        partroot=${ROOTDRIVE}p1
> -        partrootbackup=${ROOTDRIVE}p2
> -    fi
> -    # sleep to ensure filesystems are created before continuing
> -    sleep 10
> -    mke2fs ${partroot} -L Root
> -    mke2fs ${partrootbackup} -L RootBackup
> -    tune2fs -c 0 -i 0 ${partroot}
> -    tune2fs -c 0 -i 0 ${partrootbackup}
>      log "Creating LVM partition"
>  
>      if [ $ROOTDRIVE == $HOSTVGDRIVE ]; then
> @@ -682,9 +695,11 @@ perform_partitioning()
>      reread_partitions $HOSTVGDRIVE
>  
>      # sync GPT to the legacy MBR partitions
> -    if [ "gpt" == "$LABEL_TYPE" ]; then
> -        log "Running gptsync to create legacy mbr"
> -        gptsync $ROOTDRIVE
> +    if [ "$OVIRT_ROOT_INSTALL" == "y" ]; then
> +        if [ "gpt" == "$LABEL_TYPE" ]; then
> +            log "Running gptsync to create legacy mbr"
> +            gptsync $ROOTDRIVE
> +        fi
>      fi
>  
>      partpv=${HOSTVGDRIVE}${hostvgpart}

This doesn't apply to current next.  

Also, we need to ensure that we quote all variables that contain the
path to a drive like HOSTVGDRIVE and ROOTDRIVE.  This is because some
older disks and disks on vm result in wwids that contain spaces.
Some/Many of these might be fixed by the rebase since most of those were
fixed in the latest patch on next. 

Mike




More information about the ovirt-devel mailing list