Joey Boggs
2010-Apr-01 02:20 UTC
[Ovirt-devel] [PATCH node 1/3] Enables ability to have a common shared root
--- 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 + 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 + 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} -- 1.6.6.1
Joey Boggs
2010-Apr-01 02:20 UTC
[Ovirt-devel] [PATCH node 2/3] copy initrd0.img to root partition
A previous patch removed the manual initrd rebuild as dracut now builds it correctly. With that being removed the initrd0.img file was not being copied over to the system preventing boot --- scripts/ovirt-config-boot | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index 8cc127b..5f2450e 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -132,6 +132,7 @@ ovirt_boot_setup() { mkdir -p $grub_dir cp -p $live/$syslinux/vmlinuz0 $initrd_dest + cp -p $live/$syslinux/initrd0.img $initrd_dest rc=$? if [ $rc -ne 0 ]; then log "kernel image copy failed." -- 1.6.6.1
Mike Burns
2010-Apr-01 02:58 UTC
[Ovirt-devel] [PATCH node 1/3] Enables ability to have a common shared root
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}2I 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
Seemingly Similar Threads
- RESEND: [PATCH node 1/3] enables ability for a common shared root
- [PATCH node] Handle space in storage wwid
- New Storage related patches
- [PATCH node] iscsi remote root basework This lays most of the groundwork for iscsi installation and configuration. At this time configuring iscsi is disabled due to multiple issues with dependent pieces.
- [PATCH node] First draft of replacing some of the ovirt-config-* scripts with python equivalents.