Joey Boggs wrote:
This lays the groundwork for setting Root and RootBackup onto individual partitions for multiple disk installations in the future.Install, removal, upgrade testing has been performed and all seems to work at this point. --- scripts/ovirt-config-boot | 15 ++++++++------- scripts/ovirt-config-storage | 28 +++++++++++++++------------- scripts/ovirt-config-uninstall | 2 ++ scripts/ovirt-functions | 8 +++++--- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index 2961f76..dd53988 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -56,11 +56,11 @@ ovirt_boot_setup() { mkdir -p /liveos # prepare Root partition update candidate= - if [ -e /dev/HostVG/RootBackup ]; then + if [ -e /dev/disk/by-label/RootBackup ]; then candidate=RootBackup - elif [ -e /dev/HostVG/RootUpdate ]; then + elif [ -e /dev/disk/by-label/RootUpdate ]; then candidate=RootUpdate - elif [ -e /dev/HostVG/RootNew ]; then + elif [ -e /dev/disk/by-label/RootNew ]; then candidate=RootNew fi if [ -z "$candidate" ]; then @@ -69,7 +69,8 @@ ovirt_boot_setup() { umount /liveos rc=0 else - lvrename HostVG $candidate RootNew + candidate_dev=$(readlink -f /dev/disk/by-label/$candidate) + e2label $candidate_dev RootNew rc=$? fi if [ $rc -ne 0 ]; then @@ -77,7 +78,7 @@ ovirt_boot_setup() { log "$(lvdisplay -c)" return $rc fi - mount /dev/HostVG/RootNew /liveos + mount $candidate_dev /liveos # install oVirt Node image for local boot if [ -e "$live/syslinux" ]; then syslinux=syslinux @@ -146,7 +147,7 @@ set -e\ version=$(rpm -q --qf '%{version}' ovirt-node) release=$(rpm -q --qf '%{release}' ovirt-node) # reorder tty0 to allow both serial and phys console after installation - bootparams="ro root=/dev/HostVG/Root roottypefs=ext3 console=tty0 \ + bootparams="ro root=LABEL=Root roottypefs=ext3 console=tty0 \ $(echo $bootparams | sed s/console=tty0//g)" cat > /boot/grub/grub.conf << EOF default=0 @@ -176,7 +177,7 @@ EOF umount /liveos umount /boot # mark new Root ready to go, reboot() in ovirt-function switches it to active - lvrename HostVG RootNew RootUpdate + e2label $candidate_dev RootUpdaterm -rf $tmpdirlog "done." diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index eed126c..af13935 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -340,12 +340,23 @@ perform_partitioning() parted $DRIVE -s "mklabel ${LABEL_TYPE}" log "Creating boot partition" parted $DRIVE -s "mkpartfs primary ext2 0M ${boot_size_si}M" + log "Creating Root and RootBackup Partitions" + let root1_end=${boot_size_si}+${ROOT_SIZE} + let root2_end=${root1_end}+${ROOT_SIZE} + parted $DRIVE -s "mkpartfs primary ext2 ${boot_size_si}M ${root1_end}M" + parted $DRIVE -s "mkpartfs primary ext2 ${root1_end}M ${root2_end}M" + # sleep to ensure filesystems are created before continuing + sleep 10 + e2label ${DRIVE}2 Root + e2label ${DRIVE}3 RootBackup + tune2fs -c 0 -i 0 ${DRIVE}2 + tune2fs -c 0 -i 0 ${DRIVE}3 log "Creating LVM partition" - parted $DRIVE -s "mkpart primary ext2 ${boot_size_si}M -1" + parted $DRIVE -s "mkpart primary ext2 ${root2_end}M -1" log "Toggling boot on" parted $DRIVE -s "set 1 boot on" log "Toggling LVM on" - parted $DRIVE -s "set 2 lvm on" + parted $DRIVE -s "set 4 lvm on" parted $DRIVE -s "print" udevadm settle 2> /dev/null || udevsettle@@ -356,11 +367,11 @@ perform_partitioning()fipartboot=${DRIVE}1- partpv=${DRIVE}2 + partpv=${DRIVE}4 if [ ! -e "$partpv" ]; then # e.g. /dev/cciss/c0d0p2 partboot=${DRIVE}p1 - partpv=${DRIVE}p2 + partpv=${DRIVE}p4 fi log "Creating physical volume" if [ ! -e "$partpv" ]; then @@ -388,15 +399,6 @@ perform_partitioning() mkswap -L "SWAP" /dev/HostVG/Swap echo "/dev/HostVG/Swap swap swap defaults 0 0" >> /etc/fstab fi - if [ "$ROOT_SIZE" -gt 0 ]; then - log "Creating root and root backup partitions" - lvcreate --name Root --size ${ROOT_SIZE}M /dev/HostVG - mke2fs -j /dev/HostVG/Root -L "ROOT" - tune2fs -c 0 -i 0 /dev/HostVG/Root - lvcreate --name RootBackup --size ${ROOT_SIZE}M /dev/HostVG - mke2fs -j /dev/HostVG/RootBackup -L "ROOT2" - tune2fs -c 0 -i 0 /dev/HostVG/RootBackup - fi if [ "$CONFIG_SIZE" -gt 0 ]; then log "Creating config partition" lvcreate --name Config --size ${CONFIG_SIZE}M /dev/HostVG diff --git a/scripts/ovirt-config-uninstall b/scripts/ovirt-config-uninstall index 02828a0..22633a0 100755 --- a/scripts/ovirt-config-uninstall +++ b/scripts/ovirt-config-uninstall @@ -42,6 +42,8 @@ if ask_yes_or_no "Do you wish to continue and uninstall this node ([Y]es/[N]o)?" drive=$(echo $partition | awk '{ print substr($0, 1, length($0) - 1) }') parted -s $drive "rm 1" parted -s $drive "rm 2" + parted -s $drive "rm 3" + parted -s $drive "rm 4" fi printf "Finished uninstalling node." else diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index fc43343..f24cb07 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -625,9 +625,11 @@ lvremove() { reboot() { cd / # setup new Root if update is prepared - if [ -e /dev/HostVG/RootUpdate ]; then - lvrename HostVG Root RootBackup - lvrename HostVG RootUpdate Root + if [ -e "/dev/disk/by-label/RootUpdate" ]; then + root_update_dev=$(readlink -f /dev/disk/by-label/RootUpdate) + root_dev=$(readlink -f /dev/disk/by-label/Root) + e2label $root_dev RootBackup + e2label $root_update_dev Root fi # run post-install hooks # e.g. to avoid reboot loops using Cobbler PXE only once
I need to rebase this one, I'll resend shortly _______________________________________________ Ovirt-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/ovirt-devel
