[Ovirt-devel] [PATCH node] Use gpt if running on Fedora, otherwise use msdos.

Darryl L. Pierce dpierce at redhat.com
Wed Jan 7 18:52:57 UTC 2009


When creating the label when partitioning a drive, o-c-storage looks to
see if it's running in Fedora. If so then it uses gpt. Otherwise it
defaults to using msdos to have an MBR.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-storage |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index 78e56dc..2167df7 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -190,15 +190,18 @@ perform_partitioning()
         # ensure minimal BOOT partition
         BOOT_SIZE=10
     fi
-    parted $DRIVE -s "mklabel gpt"
+    parted $DRIVE -s "mklabel ${LABEL_TYPE}"
     parted $DRIVE -s "mkpartfs primary ext2 0M ${BOOT_SIZE}M"
     parted $DRIVE -s "mkpart primary ext2 ${BOOT_SIZE}M ${SPACE}M"
     parted $DRIVE -s "set 1 boot on"
     parted $DRIVE -s "set 2 lvm on"
     parted $DRIVE -s "print"
     udevadm settle 2> /dev/null || udevsettle
+
     # sync GPT to the legacy MBR partitions
-    gptsync $DRIVE
+    if [ "gpt" == "$LABEL_TYPE" ]; then
+	gptsync $DRIVE
+    fi
 
     pvcreate "${DRIVE}2"
     pvck
@@ -296,6 +299,13 @@ if [ -n "$OVIRT_INIT" ]; then
     get_selected_drive_size
 fi
 
+# if the node is Fedora then use GPT, otherwise use MBR
+if [ -f /etc/fedora-release ]; then
+    LABEL_TYPE="gpt"
+else
+    LABEL_TYPE="msdos"
+fi
+
 if [ "$1" == "AUTO" ]; then
     check_partition_sizes
     printf "Partitioning hard disk..."
-- 
1.6.0.6




More information about the ovirt-devel mailing list