Alan Pevec
2009-Mar-13 17:29 UTC
[Ovirt-devel] [PATCH node] support for cciss disk devices
assumption that partition is ${DRIVE}2 fails with cciss where we have e.g. /dev/cciss/c0d0p2 for 2nd partition on the first cciss disk. Fix is to try ${DRIVE}2 then ${DRIVE}p2. This makes ovirt_init=/dev/cciss/c0d0 work. NB: ovirt_init=scsi does not work, cciss are not reported as scsi devices. Signed-off-by: Alan Pevec <apevec at redhat.com> --- scripts/ovirt-config-boot | 6 ++++++ scripts/ovirt-config-storage | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index 2661cd9..0462c13 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -26,12 +26,14 @@ ovirt_boot_setup() { local live=$1 local bootparams=$2 local disk + local disk2 local partN=-1 log "installing oVirt Node image." mount_boot # check that /boot mounted ok and find partition number for GRUB eval $(mount|awk '$3 == "/boot" { print "disk=" substr($1,1,length($1)-1); + print "disk2=" substr($1,1,length($1)-2); partN=substr($1,length($1),1); partN--; print "partN=" partN; }') @@ -40,6 +42,10 @@ ovirt_boot_setup() { log "boot partition not available." return 1 fi + if [ ! -e "$disk" ]; then + # e.g. c0d0p1 + disk="$disk2" + fi mkdir -p /liveos # prepare Root partition update candidatediff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage index d8c93e0..c92b931 100755 --- a/scripts/ovirt-config-storage +++ b/scripts/ovirt-config-storage @@ -92,8 +92,14 @@ check_partition_sizes() # check if an existing HostVG exists on a device other than the target for vg in $(pvdisplay -c); do - eval $(echo $vg | awk '{match($0, "^([^:]*):([^:]*)", data); print "device="data[1]" name="data[2]}') - if [ "$name" == "HostVG" -a "${device:0:8}" != "$DRIVE" ]; then + device+ name+ eval $(echo $vg | awk -F: ' +/'$DRIVE'/ !~ $1 && $2=="HostVG" { + gsub("^ *","",$1); + print "device="$1" name="$2 +}') + if [ "$name" == "HostVG" ]; then udi=$(hal-find-by-property --key block.device --string $device) name=$(hal-get-property --udi $udi --key storage.serial) printf "\n" @@ -324,18 +330,32 @@ perform_partitioning() gptsync $DRIVE fi + partboot=${DRIVE}1 + partpv=${DRIVE}2 + if [ ! -e "$partpv" ]; then + # e.g. /dev/cciss/c0d0p2 + partboot=${DRIVE}p1 + partpv=${DRIVE}p2 + fi log "Creating physical volume" - dd if=/dev/zero of=${DRIVE}2 bs=1024k count=1 - pvcreate -f "${DRIVE}2" - pvck -v + if [ ! -e "$partpv" ]; then + log "$partpv is not available!" + exit 1 + fi + dd if=/dev/zero of=${partpv} bs=1024k count=1 + pvcreate -f "${partpv}" log "Creating volume group" - vgcreate /dev/HostVG "${DRIVE}2" + vgcreate /dev/HostVG "${partpv}" log "Creating boot filesystem" - mke2fs -j "${DRIVE}1" -L "BOOT" - tune2fs -c 0 -i 0 "${DRIVE}1" + if [ ! -e "$partboot" ]; then + log "$partboot is not available!" + exit 1 + fi + mke2fs -j "${partboot}" -L "BOOT" + tune2fs -c 0 -i 0 "${partboot}" mkdir -p /dev/disk/by-label - ln -snf "${DRIVE}1" /dev/disk/by-label/BOOT + ln -snf "${partboot}" /dev/disk/by-label/BOOT if [ "$SWAP_SIZE" -gt 0 ]; then log "Creating swap partition" -- 1.6.0.6