[PATCH 27/29] We no longer need to copy the install.img over and lochangefd to it.

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

 



Since there is no more install.img, this whole process is pointless and all
its support code can come out.
---
 pyanaconda/backend.py          |   77 ----------------------------------------
 pyanaconda/isys/__init__.py    |   10 -----
 pyanaconda/isys/isys.c         |   22 -----------
 pyanaconda/storage/__init__.py |   30 ---------------
 pyanaconda/yuminstall.py       |    9 -----
 5 files changed, 0 insertions(+), 148 deletions(-)

diff --git a/pyanaconda/backend.py b/pyanaconda/backend.py
index 0341e9f..06f8c0b 100644
--- a/pyanaconda/backend.py
+++ b/pyanaconda/backend.py
@@ -57,8 +57,6 @@ class AnacondaBackend:
         self.skipFormatRoot = False
         self.rootFsType = None
 
-        self._loopbackFile = None
-
     def postAction(self, anaconda):
         pass
 
@@ -136,81 +134,6 @@ class AnacondaBackend:
         else:
             self.modeText = _("Installing %s\n")
 
-    def mountInstallImage(self, anaconda, installimg):
-        if self._loopbackFile and os.path.exists(self._loopbackFile):
-            return
-
-        # Copy the install.img to the filesystem and switch loopback devices
-        # to there.  Otherwise we won't be able to unmount and swap media.
-        free = anaconda.storage.fsFreeSpace
-        self._loopbackFile = "%s/%s/rhinstall-install.img" % (anaconda.rootPath,
-                                                              free[-1][0])
-        try:
-            log.info("transferring install image to install target")
-            win = anaconda.intf.waitWindow(_("Copying File"),
-                    _("Transferring install image to hard drive"))
-            shutil.copyfile(installimg, self._loopbackFile)
-            win.pop()
-        except Exception, e:
-            if win:
-                win.pop()
-
-            log.critical("error transferring install.img: %s" %(e,))
-
-            if isinstance(e, IOError) and e.errno == 5:
-                msg = _("An error occurred transferring the install image "
-                        "to your hard drive.  This is often cause by "
-                        "damaged or low quality media.")
-            else:
-                msg = _("An error occurred transferring the install image "
-                        "to your hard drive. You are probably out of disk "
-                        "space.")
-
-            anaconda.intf.messageWindow(_("Error"), msg)
-            try:
-                os.unlink(self._loopbackFile)
-            except:
-                pass
-
-            return 1
-
-        # Figure out which loopback device is in use for lochangefd.
-        dev = "/dev/loop0"
-        f = open("/proc/mounts", "r")
-        lines = f.readlines()
-        f.close()
-
-        for line in lines:
-            parts = line.split()
-            if parts[1] == "/mnt/runtime":
-                dev = parts[0]
-                break
-
-        isys.lochangefd(dev, self._loopbackFile)
-        if os.path.ismount("/mnt/stage2"):
-            isys.umount("/mnt/stage2")
-
-    def removeInstallImage(self):
-        if self._loopbackFile:
-            try:
-                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):
-            # 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 []
 
diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py
index aebcad1..f11d31e 100755
--- a/pyanaconda/isys/__init__.py
+++ b/pyanaconda/isys/__init__.py
@@ -80,16 +80,6 @@ EARLY_SWAP_RAM = _isys.EARLY_SWAP_RAM
 def pathSpaceAvailable(path):
     return _isys.devSpaceFree(path)
 
-def lochangefd(device, file):
-    # FIXME: implement this as a storage.devices.Device subclass
-    loop = os.open(device, os.O_RDONLY)
-    targ = os.open(file, os.O_RDONLY)
-    try:
-        _isys.lochangefd(loop, targ)
-    finally:
-        os.close(loop)
-        os.close(targ)
-
 ## Mount a filesystem, similar to the mount system call.
 # @param device The device to mount.  If bindMount is True, this should be an
 #               already mounted directory.  Otherwise, it should be a device
diff --git a/pyanaconda/isys/isys.c b/pyanaconda/isys/isys.c
index 3b7fe73..f09d0b8 100644
--- a/pyanaconda/isys/isys.c
+++ b/pyanaconda/isys/isys.c
@@ -90,7 +90,6 @@ static PyObject * doSwapon(PyObject * s, PyObject * args);
 static PyObject * doSwapoff(PyObject * s, PyObject * args);
 static PyObject * doLoSetup(PyObject * s, PyObject * args);
 static PyObject * doUnLoSetup(PyObject * s, PyObject * args);
-static PyObject * doLoChangeFd(PyObject * s, PyObject * args);
 static PyObject * doWipeRaidSuperblock(PyObject * s, PyObject * args);
 static PyObject * doGetRaidChunkSize(PyObject * s, PyObject * args);
 static PyObject * doDevSpaceFree(PyObject * s, PyObject * args);
@@ -124,7 +123,6 @@ static PyMethodDef isysModuleMethods[] = {
     { "devSpaceFree", (PyCFunction) doDevSpaceFree, METH_VARARGS, NULL },
     { "wiperaidsb", (PyCFunction) doWipeRaidSuperblock, METH_VARARGS, NULL },
     { "getraidchunk", (PyCFunction) doGetRaidChunkSize, METH_VARARGS, NULL },
-    { "lochangefd", (PyCFunction) doLoChangeFd, METH_VARARGS, NULL },
     { "losetup", (PyCFunction) doLoSetup, METH_VARARGS, NULL },
     { "unlosetup", (PyCFunction) doUnLoSetup, METH_VARARGS, NULL },
     { "mount", (PyCFunction) doMount, METH_VARARGS, NULL },
@@ -166,26 +164,6 @@ static PyObject * doUnLoSetup(PyObject * s, PyObject * args) {
     return Py_None;
 }
 
-/* XXX - msw */
-#ifndef LOOP_CHANGE_FD
-#define LOOP_CHANGE_FD	0x4C06
-#endif
-
-static PyObject * doLoChangeFd(PyObject * s, PyObject * args) {
-    int loopfd;
-    int targfd;
-
-    if (!PyArg_ParseTuple(args, "ii", &loopfd, &targfd)) 
-	return NULL;
-    if (ioctl(loopfd, LOOP_CHANGE_FD, targfd)) {
-	PyErr_SetFromErrno(PyExc_SystemError);
-	return NULL;
-    }
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
 static PyObject * doLoSetup(PyObject * s, PyObject * args) {
     int loopfd;
     int targfd;
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index cba443b..b8b1c90 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1177,10 +1177,6 @@ class Storage(object):
         self.fsset.createSwapFile(device, size)
 
     @property
-    def fsFreeSpace(self):
-        return self.fsset.fsFreeSpace()
-
-    @property
     def mtab(self):
         return self.fsset.mtab()
 
@@ -1761,32 +1757,6 @@ class FSSet(object):
                         # just write duplicates back out post-install
                         self.preserveLines.append(line)
 
-    def fsFreeSpace(self, chroot=None):
-        if not chroot:
-            chroot = self.rootpath
-
-        space = []
-        for device in self.devices:
-            if not device.format.mountable or \
-               not device.format.mountpoint or \
-               not device.format.status:
-                continue
-
-            path = "%s/%s" % (chroot, device.format.mountpoint)
-
-            ST_RDONLY = 1   # this should be in python's posix module
-            if not os.path.exists(path) or os.statvfs(path)[statvfs.F_FLAG] & ST_RDONLY:
-                continue
-
-            try:
-                space.append((device.format.mountpoint,
-                              isys.pathSpaceAvailable(path)))
-            except SystemError:
-                log.error("failed to calculate free space for %s" % (device.format.mountpoint,))
-
-        space.sort(key=lambda s: s[1])
-        return space
-
     def mtab(self):
         format = "%s %s %s %s 0 0\n"
         mtab = ""
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 6c0ddda..edb2bf0 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -933,12 +933,6 @@ class AnacondaYum(YumSorter):
         mkeys = self.tsInfo.reqmedia.keys()
         mkeys.sort(mediasort)
 
-        stage2img = "%s/images/install.img" % self.tree
-        if os.path.exists(stage2img):
-            if self.anaconda.backend.mountInstallImage(self.anaconda, stage2img):
-                self.anaconda.storage.umountFilesystems()
-                return DISPATCH_BACK
-
         for i in mkeys:
             self.tsInfo.curmedia = i
             if i > 0:
@@ -1170,8 +1164,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
         if not anaconda.mediaDevice and os.path.ismount(self.ayum.tree):
             isys.umount(self.ayum.tree)
 
-        anaconda.backend.removeInstallImage()
-
         # clean up rpmdb locks so that kickstart %post scripts aren't
         # unhappy (#496961)
         iutil.resetRpmDb(anaconda.rootPath)
@@ -1188,7 +1180,6 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
            iutil.resetRpmDb(anaconda.rootPath)
 
         iutil.writeRpmPlatform()
-        anaconda.backend.freetmp(anaconda)
         self.ayum = AnacondaYum(anaconda)
         self.ayum.setup()
 
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux