Skip to contentSkip to conversation

Remove temporary {kernel, ramdisk} file when VmError occurred

PATCH New Masaki Kanno 1 participant 1 message Mar 2, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove temporary {kernel, ramdisk} file when VmError occurred

Hi,

I tested the xm create command with the pygrub bootloader. When I gave a wrong memory parameter, a temporary kernel file and a temporary ramdisk file were left in the directory "/var/run/xend/boot/".

# ls -l /var/run/xend/boot/
total 0
# xm create /etc/xen/vm1-pygrub memory=8192
Using config file "/etc/xen/vm1-pygrub".
Error: Not enough free memory and dom0_min_mem is 0, so I cannot release any more.  I need 8388608 KiB but only have 6147892.
# ls -l /var/run/xend/boot/
total 4072
-rw------- 1 root root 1894458 Mar  2 19:26 boot_kernel.C0dFE9
-rw------- 1 root root 2261525 Mar  2 19:26 boot_ramdisk.Sq4fww
#

When free memory is not enough, balloon.free() causes VmError exception. However, _initDomain() is not catching VmError exception, so image.cleanupBootloading() is not executed. As the result, the temporary kernel file and the temporary ramdisk file were left in the directory "/var/run/xend/boot/".
This patch fixes _initDomain(). _initDomain() catches VmError exception, and executes image.cleanupBootloading().

Best regards,
Kan

tools/python/xen/xend/XendDomainInfo.py +1 -1
diff -r 139794d55898 tools/python/xen/xend/XendDomainInfo.py
@@ -1502,7 +1502,7 @@ class XendDomainInfo:
             self.info['start_time'] = time.time()
 
             self._stateSet(DOM_STATE_RUNNING)
-        except RuntimeError, exn:
+        except (RuntimeError, VmError), exn:
             log.exception("XendDomainInfo.initDomain: exception occurred")
             self.image.cleanupBootloading()
             raise VmError(str(exn))

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel