Mike Burns
2010-Apr-07 14:15 UTC
[Ovirt-devel] [PATCH node] RESEND: [PATCH node 1/3] enables ability for a common shared root
From: Joey Boggs <jboggs at redhat.com>
---
scripts/ovirt-config-boot | 13 ++++++-
scripts/ovirt-config-storage | 80 +++++++++++++++++++++++++-----------------
2 files changed, 60 insertions(+), 33 deletions(-)
diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
index 72bcd9b..9593905 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
@@ -213,7 +219,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 ce9707c..35cb340 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -358,6 +358,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
@@ -403,6 +419,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
@@ -558,7 +576,7 @@ check_existing_hostvg()
# - remove LVM volumes and groups
wipe_lvm_on_disk()
{
- local dev=${1-$HOSTVGDRIVE}
+ local dev=${1-"$HOSTVGDRIVE"}
unmount_logging
local part_delim="p"
if [[ "$dev" =~ "/dev/sd" ]]; then
@@ -605,8 +623,8 @@ perform_partitioning()
unmount_config /etc/default/ovirt
log "Removing old LVM partitions"
- wipe_lvm_on_disk $HOSTVGDRIVE
- wipe_lvm_on_disk $ROOTDRIVE
+ wipe_lvm_on_disk "$HOSTVGDRIVE"
+ wipe_lvm_on_disk "$ROOTDRIVE"
# begin critical section
set -e
@@ -636,37 +654,33 @@ 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
+ reread_partitions "$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
@@ -683,9 +697,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_INSTALL_ROOT}" == "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
Mike Burns
2010-Apr-07 14:28 UTC
[Ovirt-devel] [PATCH node] RESEND: [PATCH node 1/3] enables ability for a common shared root
On Wed, 2010-04-07 at 10:15 -0400, Mike Burns wrote:> From: Joey Boggs <jboggs at redhat.com> > > --- > scripts/ovirt-config-boot | 13 ++++++- > scripts/ovirt-config-storage | 80 +++++++++++++++++++++++++----------------- > 2 files changed, 60 insertions(+), 33 deletions(-) > > diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot > index 72bcd9b..9593905 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 > @@ -213,7 +219,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 ce9707c..35cb340 100755 > --- a/scripts/ovirt-config-storage > +++ b/scripts/ovirt-config-storage > @@ -358,6 +358,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 > @@ -403,6 +419,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 > @@ -558,7 +576,7 @@ check_existing_hostvg() > # - remove LVM volumes and groups > wipe_lvm_on_disk() > { > - local dev=${1-$HOSTVGDRIVE} > + local dev=${1-"$HOSTVGDRIVE"} > unmount_logging > local part_delim="p" > if [[ "$dev" =~ "/dev/sd" ]]; then > @@ -605,8 +623,8 @@ perform_partitioning() > unmount_config /etc/default/ovirt > > log "Removing old LVM partitions" > - wipe_lvm_on_disk $HOSTVGDRIVE > - wipe_lvm_on_disk $ROOTDRIVE > + wipe_lvm_on_disk "$HOSTVGDRIVE" > + wipe_lvm_on_disk "$ROOTDRIVE" > > # begin critical section > set -e > @@ -636,37 +654,33 @@ 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 > + reread_partitions "$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}2These 4 lines need to be changed. For multipath and cciss devices, the partitions are like ${ROOTDRIVE}p1. - mke2fs ${ROOTDRIVE}1 -L Root - mke2fs ${ROOTDRIVE}2 -L RootBackup - tune2fs -c 0 -i 0 ${ROOTDRIVE}1 - tune2fs -c 0 -i 0 ${ROOTDRIVE}2 + reread_partitions "$ROOTDRIVE" + partroot="${ROOTDRIVE}1" + partrootbackup="${ROOTDRIVE}2" + if [ ! -e "$partroot" ]; then + partroot="${ROOTDRIVE}p1" + partrootbackup="${ROOTDRIVE}p2" + fi + mke2fs "$partroot}" -L Root + mke2fs "${partrootbackup}" -L RootBackup + tune2fs -c 0 -i 0 "${partroot}" + tune2fs -c 0 -i 0 "${partrootbackup}"> + 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 > @@ -683,9 +697,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_INSTALL_ROOT}" == "y" ]; then > + if [ "gpt" == "$LABEL_TYPE" ]; then > + log "Running gptsync to create legacy mbr" > + gptsync "$ROOTDRIVE" > + fi > fi > > partpv="${HOSTVGDRIVE}${hostvgpart}"