[Ovirt-devel] [PATCH node] Enables ability to have a common shared root
Joey Boggs
jboggs at redhat.com
Fri Jan 22 03:05:49 UTC 2010
Nodes can now have a unique HostVG and share a common root. The nodes must use lun masking or similar to hide other HostVG volume groups from other nodes.
---
scripts/ovirt-config-boot | 12 +++++++-
scripts/ovirt-config-storage | 67 +++++++++++++++++++++++++++--------------
2 files changed, 55 insertions(+), 24 deletions(-)
diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
index fb956f3..d64f683 100755
--- a/scripts/ovirt-config-boot
+++ b/scripts/ovirt-config-boot
@@ -29,6 +29,11 @@ ovirt_boot_setup() {
local disk2
local partN=-1
log "installing the image."
+
+ if [ "$OVIRT_ROOT_INSTALL" == "n" ]; then
+ log "done."
+ return
+ fi
if [ -h /dev/disk/by-label/Boot ]; then
mount_boot
mountpoint /boot
@@ -261,7 +266,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 2ffcaa4..17938ec 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -226,6 +226,22 @@ do_configure()
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
get_drive_size $HOSTVGDRIVE HOSTVGDRIVESPACE
@@ -249,6 +265,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
@@ -412,30 +430,31 @@ 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
- blockdev --rereadpt $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"
- # 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
log "Creating LVM partition"
if [ $ROOTDRIVE == $HOSTVGDRIVE ]; then
@@ -451,9 +470,11 @@ perform_partitioning()
udevadm settle 2> /dev/null || udevsettle
# 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
More information about the ovirt-devel
mailing list