Esempio n. 1
0
    def preResize(self, partition):
        cmd_path = sysutils.find_executable("e2fsck")

        if not cmd_path:
            raise FSError, "Command not found to resize %s filesystem" % (self.name())

        res = sysutils.execClear("e2fsck",
                                ["-f", "-p", "-C", "0", partition.getPath()],
                                stdout="/tmp/resize.log",
                                stderr="/tmp/resize.log")
        if res >= 4:
            raise FSError, "FSCheck failed on %s" % (partition.getPath())

        return True
Esempio n. 2
0
    def preResize(self, partition):
        """ Routine operations before resizing """
        cmd_path = requires("e2fsck")

        res = sysutils.execClear(cmd_path,
                                ["-y", "-f", "-C", "0", partition.getPath()],
                                stdout="/tmp/resize.log",
                                stderr="/tmp/resize.log")

        if res == 2:
            raise FSCheckError, _("""FSCheck found some problems on partition %s and fixed them. \
                                You should restart the machine before starting the installation process !""" % (partition.getPath()))
        elif res > 2:
            raise FSCheckError, _("FSCheck failed on %s" % (partition.getPath()))

        return True
Esempio n. 3
0
    def resize(self, size_mb, partition):

        if size_mb < self.minResizeMB(partition):
            return False

        p = os.pipe()
        os.write(p[1], "y\n")
        os.close(p[1])

        res = sysutils.execClear("ntfsresize",
                                ["-f","-s","%sM" % (size_mb), partition.getPath()],
                                stdin = P[0],
                                stdout = "/tmp/resize.log",
                                stderr = "/tmp/resize.log")
        if res:
            raise FSError, "Resize failed on %s " % partition.getPath()

        return True
Esempio n. 4
0
    def resize(self, size_mb, partition):
        if size_mb < self.minResizeMB(partition):
            return False

        cmd_path = sysutils.find_executable("resize2fs")

        if not cmd_path:
            e = "Command not found to format %s filesystem" %(self.name())
            raise FSError, e 

        res = sysutils.execClear("resize2fs",
                                ["-f", partition.getPath(), "%sM" %(size_mb)],
                                stdout="/tmp/resize.log",
                                stderr="/tmp/resize.log")
        if res:
            raise FSError, "Resize failed on %s" % (partition.getPath())

        return True
Esempio n. 5
0
    def preResize(self, partition):
        """ Routine operations before resizing """
        cmd_path = requires("e2fsck")

        res = sysutils.execClear(
            cmd_path,
            ["-y", "-f", "-C", "0", partition.getPath()],
            stdout="/tmp/resize.log",
            stderr="/tmp/resize.log")

        if res == 2:
            raise FSCheckError, _(
                """FSCheck found some problems on partition %s and fixed them. \
                                     You should restart the machine before starting the installation process !"""
                % (partition.getPath()))
        elif res > 2:
            raise FSCheckError, _("FSCheck failed on %s" %
                                  (partition.getPath()))

        return True