Darryl L. Pierce
2009-Feb-25 18:38 UTC
[Ovirt-devel] [PATCH node] Add removal of the boot partition to the uninstall feature.
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
Alan Pevec
2009-Feb-25 23:08 UTC
[Ovirt-devel] [PATCH node] Add removal of the boot partition to the uninstall feature.
On Wed, Feb 25, 2009 at 7:38 PM, Darryl L. Pierce <dpierce at redhat.com> wrote:> + ? ?log "Labeling boot partition" > + ? ?tune2fs -L OVBOOT ${DRIVE}1it's already labeled when fs is created: mke2fs -j "${DRIVE}1" -L "BOOT" so old local installations with BOOT won't be uninstalled if we change to OVBOOT now. Did you want to change to OVBOOT to lower the conflict possibility? Default RHEL/Fedora uses lablel "/boot" so BOOT shouldn't have conflicts. Also, label BOOT is used at least in mount_boot() so that would need to be adjusted.> + ? ? ? 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] }')or just: awk '{ print substr($0,1,length($0)-1); }'> + ? ? ? ? ? parted -s $drive "rm 1" > + ? ? ? ? ? parted -s $drive "rm 2" > + ? ? ? fi > + ? ? ? printf "Finished uninstalling node."