Joey Boggs
2009-Sep-30 16:24 UTC
[Ovirt-devel] [PATCH node] RESEND: split root file systems out of HostVG onto separate partitions
rebased it against current next-devel
---
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 ed2bb9f..01c1821 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
@@ -196,7 +197,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)"
# append mpath and filter if selected disk is /dev/mpath/*
if [[ "$disk" =~ "^/dev/mpath/" ]]; then
@@ -250,7 +251,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 RootUpdate
rm -rf $tmpdir
log "done."
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index c448aee..06a5363 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -531,12 +531,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
if [[ "$DRIVE" =~ "^/dev/mapper" ]]; then
@@ -550,11 +561,11 @@ perform_partitioning()
fi
partboot=${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
@@ -582,15 +593,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 20f8c2c..95a71a9 100755
--- a/scripts/ovirt-config-uninstall
+++ b/scripts/ovirt-config-uninstall
@@ -58,6 +58,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
service multipathd restart
printf "Finished uninstalling node."
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
--
1.6.2.5
Reasonably Related Threads
- [PATCH node] split root filesystems out of HostVG and onto their own partitions
- [PATCH node] merge Root and /boot partitions
- [PATCH node] Enables stateless iscsi remote boot
- [PATCH node][RFC] Remove dependencies on /dev/disk/by-label entries
- [PATCH node] Handle space in storage wwid
