From f4459b4108fb8c0aad05653c7c8cdf8d3050f76a Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 16 Dec 2009 16:10:01 -0500 Subject: Add a method to remove /tmp/install.img on low memory conditions (jvonau). --- backend.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend.py b/backend.py index f87ff6554..2ed8249e8 100644 --- a/backend.py +++ b/backend.py @@ -192,6 +192,21 @@ class AnacondaBackend: os.unlink(self._loopbackFile) except SystemError: pass + + def freetmp(self, anaconda): + # installs that don't use /mnt/stage2 hold the install.img on + # a tmpfs, free this ram if things are tight. + stage2img = "/tmp/install.img" + if os.path.exists(stage2img) and iutil.memAvailable() < isys.MIN_GUI_RAM: + log.info("%s exists and low memory" % stage2img ) + # free up /tmp for more memory before yum is called, + if self.mountInstallImage(anaconda, stage2img): + return DISPATCH_BACK + try: + os.unlink(stage2img) + except SystemError: + log.info("clearing /tmp failed") + return DISPATCH_BACK def kernelVersionList(self, rootPath="/"): return [] -- cgit