[Ovirt-devel] [PATCH node] add cleanup after local install failures
Alan Pevec
apevec at redhat.com
Tue Sep 23 12:35:55 UTC 2008
Signed-off-by: Alan Pevec <apevec at redhat.com>
---
scripts/ovirt-early | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index 6dff7ab..d2caf9b 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -232,11 +232,16 @@ local_install() {
live=$(mktemp -d)
mount -r $live_dev $live
if [ $? -ne 0 ]; then
- echo "source image mount failed"; return 1
+ echo "source image mount failed"
+ rmdir $live
+ return 1
fi
mount $part $ovirt
if [ $? -ne 0 ]; then
- echo "target mount failed"; return 1
+ echo "target mount failed"
+ umount $live && rmdir $live
+ rmdir $ovirt
+ return 1
fi
mkdir -p $ovirt/config
# update local config using the one embedded in livecd image
@@ -267,7 +272,10 @@ local_install() {
&& cp -p $live/$syslinux/initrd0.img $ovirt/boot \
&& cp -p $live/$syslinux/vmlinuz0 $ovirt/boot
if [ $? -ne 0 ]; then
- echo "image copy failed"; return 1
+ echo "image copy failed"
+ umount $ovirt && rmdir $ovirt
+ umount $live && rmdir $live
+ return 1
fi
part_num=$(( ${part#$disk} - 1 ))
cat > $ovirt/boot/grub/grub.conf << EOF
--
1.5.5.1
More information about the ovirt-devel
mailing list