[Ovirt-devel] [PATCH node] Add removal of the boot partition to the uninstall feature.

Darryl L. Pierce dpierce at redhat.com
Wed Feb 25 18:38:25 UTC 2009


When the system is installed, a label is applied to the /boot partition,
"OVBOOT". On uninstall, that device is located and the partitions are
removed.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-storage   |    3 +++
 scripts/ovirt-config-uninstall |   23 +++++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index c9225f7..3aae5b8 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -361,6 +361,9 @@ perform_partitioning()
         echo "/dev/HostVG/Logging /var/log ext3 defaults 0 0" >> /etc/fstab
     fi
 
+    log "Labeling boot partition"
+    tune2fs -L OVBOOT ${DRIVE}1
+
     local use_data=1
     if [ "$DATA_SIZE" -eq -1 ]; then
         log "Creating data partition with remaining free space"
diff --git a/scripts/ovirt-config-uninstall b/scripts/ovirt-config-uninstall
index 70dcb47..506f2b8 100755
--- a/scripts/ovirt-config-uninstall
+++ b/scripts/ovirt-config-uninstall
@@ -31,15 +31,26 @@ read -ep "Do you wish to continue and uninstall this node (Y/N)? "
 
 if [ "$REPLY" == "Y" -o "$REPLY" == "y" ]; then
     if [ -d /dev/HostVG ]; then
-	printf "\nUNINSTALLING NODE...\n\n"
+	log "Uninstalling node"
+	log "Detaching logging"
 	unmount_logging
+	log "Removing volume group"
 	wipe_volume_group "HostVG"
-	printf "\nDONE!\n"
+	partition=$(findfs LABEL=OVBOOT)
+	if [ -n "$partition" ]; then
+	    log "Unmounting boot partition"
+	    umount $partition
+	    log "Removing partitions"
+	    drive=$(echo $partition | awk '{ match($0, "(.*)[0-9]$", drive); print drive[1] }')
+	    parted -s $drive "rm 1"
+	    parted -s $drive "rm 2"
+	fi
+	printf "Finished uninstalling node."
     else
-	printf "\nThere is no installed node instance to remove.\n"
-	printf "\nAborting...\n"
-	return 1
+	log "There is no installed node instance to remove."
+	log "Aborting"
+	exit 1
     fi
 else
-    printf "\nABORTED!\n"
+    log "Aborted"
 fi
-- 
1.6.0.6




More information about the ovirt-devel mailing list