예제 #1
0
    def __init__(self, screen):
        """
        Constructor

        @type  screen: SnackScreen
        @param screen: SnackScreen instance
        """
        self.__total = 0
        self.__dev = Env.get('systemupdate.disk')

        self.__screen = screen
        self.__progressBar = Scale(self.__screen.width-35, 100)
        self.__msg = TextboxReflowed(self.__screen.width-30, "Preparing system to update PowerKVM")

        self.__grid = GridForm(self.__screen, "IBM PowerKVM", 1, 3)
        self.__grid.add(self.__progressBar, 0, 0)
        self.__grid.add(self.__msg, 0, 1, (0, 1, 0, 0))
예제 #2
0
def createWorkDirectory(disk):
    """
    Create work directory to update system
    The work directory is an union between the current root file system and the
    cow partition content

    @type  disk: string
    @param disk: path to the disk [/dev/<name>]

    @rtype: tuple
    @returns: (new root partition, path to the work directory)
    """
    if not isBlockDevice(disk):
        return (None, None)

    currentRoot = getCurrentRootPartition(disk)
    if currentRoot is None:
        return (None, None)

    newRootPartition = getNewRootPartition(disk)
    if newRootPartition is None:
        return (None, None)

    filesystem = Env.get('systemupdate.filesystem')
    if filesystem is None:
        filesystem = ""

    cmd = "union_squashfs_cow %s %s %s \"%s\"" % (currentRoot, TARBALL_REPO, POWERKVM_REPO, filesystem)
    status, directory = commands.getstatusoutput(". %s && %s" % (POWERKVM_FUNCTIONS, cmd))
    if status != 0:
        return (None, None)

    if not os.path.exists(directory):
        return (None, None)

    return (newRootPartition, directory)