[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

PATCH fix 510970, 529551, 530541



This is currently untested, but I'm looking for feedback. Think most of
the issues with the size of /boot can be traced to preupgrade or
backend.py:
        
free = anaconda.id.storage.fsFreeSpace
self._loopbackFile = "%s%s/rhinstall-install.img" % (anaconda.rootPath,
                                                             free[0][0])

This ends up placing self._loopbackFile on /mnt/sysimage/boot and is
causing anaconda to not have enough room to copy the install.img. I just
changed the path to be /mnt/sysimage/tmp, should have lots of room
there.

While in the preupgrade case, /boot may not be able to hold the new
kernel due to having /boot/upgrade/install.img on its filesystem. This
gets copied to /tmp and just takes up space on boot once anaconda loads.
As a bonus once install.img is copied to /mnt/sysimage/tmp, anaconda's 
/tmp is purged of the install.img, if present, freeing up ram.

Hoping I'm on the right track,

Jerry

diff -up ./backend.py.orig ./backend.py
--- ./backend.py.orig	2009-11-12 10:28:33.000000000 -0600
+++ ./backend.py	2009-11-12 14:04:48.000000000 -0600
@@ -154,28 +154,46 @@ class AnacondaBackend:
             return
 
         if self._loopbackFile and os.path.exists(self._loopbackFile):
+            log.info("and exists %s" % self._loopbackFile )
             return
-
-        # If we've booted off the first CD/DVD (so, not the boot.iso) then
-        # copy the install.img to the filesystem and switch loopback devices
-        # to there.  Otherwise we won't be able to unmount and swap media.
-        if not anaconda.mediaDevice or not os.path.exists(installimg):
+ 
+         # If they booted with a boot.iso, just continue using that install.img.
+        if os.path.exists("/mnt/stage2/images/install.img"):
+            log.info("Don't need to transfer stage2 image")
             return
+ 
+         # If we've booted off the first CD/DVD (so, not the boot.iso) then
+         # copy the install.img to the filesystem and switch loopback devices
+         # to there.  Otherwise we won't be able to unmount and swap media.
+        log.info("mediaDevice is %s" % anaconda.mediaDevice )
+        log.info("Using %s as stage2 image" % installimg)
+        if not anaconda.mediaDevice or not os.path.exists(installimg):
+ 
 
-        free = anaconda.id.storage.fsFreeSpace
         self._loopbackFile = "%s%s/rhinstall-install.img" % (anaconda.rootPath,
-                                                             free[0][0])
+                                                               "/tmp")
+        log.info("New image name %s" % self._loopbackFile )
+
+        # This s/b the one that was copied into /tmp .... 
+        # Why was this copied to ram when you have passed stage2= 
+        # lets free the RAM
+        if os.path.exists("/tmp/install.img"):
+            log.info("OVERRIDE Using /tmp/install.img as stage2 image")
+            stage2img = "/tmp/install.img"
+            stage2ram = 1
+        else:
+            stage2img = installimg
 
         try:
             win = anaconda.intf.waitWindow(_("Copying File"),
-                    _("Transferring install image to hard drive"))
-            shutil.copyfile(installimg, self._loopbackFile)
+                   _("Transferring install image to hard drive..."))
+            shutil.copyfile(stage2img, self._loopbackFile)
             win.pop()
         except Exception, e:
             if win:
                 win.pop()
 
-            log.critical("error transferring install.img: %s" %(e,))
+            log.critical("error transferring stage2img: %s" %(e,))
 
             if isinstance(e, IOError) and e.errno == 5:
                 msg = _("An error occurred transferring the install image "
@@ -195,7 +213,20 @@ class AnacondaBackend:
             return 1
 
         isys.lochangefd("/dev/loop0", self._loopbackFile)
-        isys.umount("/mnt/stage2")
+
+        if os.path.exists("/mnt/sysimage/boot/upgrade/install.img"):
+            log.info("REMOVING stage2 image from /mnt/sysimage/boot/upgrade")
+            os.unlink ("/mnt/sysimage/boot/upgrade/install.img")
+
+        if stage2ram
+            try:
+                os.unlink(stage2img)
+            except:
+                pass 
+        try:
+            isys.umount("/mnt/stage2")
+        except:
+            pass
 
     def removeInstallImage(self):
         if self._loopbackFile:
diff -up ./yuminstall.py.orig ./yuminstall.py
--- ./yuminstall.py.orig	2009-11-12 10:28:33.000000000 -0600
+++ ./yuminstall.py	2009-11-12 12:04:54.000000000 -0600
@@ -631,6 +631,9 @@ class AnacondaYum(YumSorter):
 
 
     def doConfigSetup(self, fn='/tmp/anaconda-yum.conf', root='/'):
+        stage2img = "%s/images/install.img" % self.tree
+        self.anaconda.backend.mountInstallImage(self.anaconda, stage2img)
+
         if hasattr(self, "preconf"):
             self.preconf.fn = fn
             self.preconf.root = root
@@ -858,12 +861,6 @@ class AnacondaYum(YumSorter):
         mkeys = self.tsInfo.reqmedia.keys()
         mkeys.sort(mediasort)
 
-        if len(mkeys) > 1:
-            stage2img = "%s/images/install.img" % self.tree
-            if self.anaconda.backend.mountInstallImage(self.anaconda, stage2img):
-                self.anaconda.id.storage.umountFilesystems()
-                return DISPATCH_BACK
-
         for i in mkeys:
             self.tsInfo.curmedia = i
             if i > 0:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]