def __build_transaction(self):
        """Determin what kind of transaction to build
        Builds transactions for:
        - Installation
        - Upgrade
        """
        cfg = self.__build_config()

        self.logger.debug("Building transaction")

        tx = utils.Transaction("Installation")

        if cfg["method"] in ["install"]:
            tx += [self.UpdateDefaultsFromModels(cfg),
                   self.PartitionAndFormat(cfg["installation.devices"]),
                   self.SetPassword(cfg["admin.password"]),
                   self.InstallImageAndBootloader(cfg["boot.device.current"]),
                   self.SetKeyboardLayout(cfg["keyboard.layout"])]
            if "disable_kdump" not in system.kernel_cmdline_arguments():
                tx += [self.ConfigureKdump()]

            if system.is_pxe():
                    tx += [self.ClearNetworkConfig()]

        elif cfg["method"] in ["upgrade", "downgrade", "reinstall"]:
            tx.title = "Update"
            tx += [self.InstallImageAndBootloader()]
            tx += [self.SetKeyboardLayout(cfg["keyboard.layout"])]
            new_password = cfg.get("upgrade.password", None)
            if new_password:
                tx += [self.SetPassword(new_password)]

        self.logger.debug("Built transaction: %s" % tx)

        return tx
    def live_disk_name(self):
        """get the device name of the live-media we are booting from
        BEWARE: Because querying this is so expensive we cache this result
                Assumption: Live disk name does not change
        """
        if self._cached_live_disk_name:
            return self._cached_live_disk_name

        if system.is_pxe():
            # We're PXE, don't filter anything
            name = ""
        else:
            from ovirtnode.ovirtfunctions import get_live_disk
            name = get_live_disk()
            if "/dev/mapper" not in name:
                # FIXME explain ...
                name = "/dev/%s" % name.rstrip('0123456789')
        self._cached_live_disk_name = name
        return name
Exemple #3
0
    def live_disk_name(self):
        """get the device name of the live-media we are booting from
        BEWARE: Because querying this is so expensive we cache this result
                Assumption: Live disk name does not change
        """
        if self._cached_live_disk_name:
            return self._cached_live_disk_name

        if system.is_pxe():
            # We're PXE, don't filter anything
            name = ""
        else:
            from ovirtnode.ovirtfunctions import get_live_disk
            name = get_live_disk()
            if "/dev/mapper" not in name:
                # FIXME explain ...
                name = "/dev/%s" % name.rstrip('0123456789')
        self._cached_live_disk_name = name
        return name
Exemple #4
0
    def __build_transaction(self):
        """Determin what kind of transaction to build
        Builds transactions for:
        - Installation
        - Upgrade
        """
        cfg = self.__build_config()

        self.logger.debug("Building transaction")

        tx = utils.Transaction("Installation")

        if cfg["method"] in ["install"]:
            tx += [
                self.UpdateDefaultsFromModels(cfg),
                self.PartitionAndFormat(cfg["installation.devices"]),
                self.SetPassword(cfg["admin.password"]),
                self.InstallImageAndBootloader(cfg["boot.device.current"]),
                self.SetKeyboardLayout(cfg["keyboard.layout"])
            ]
            if "disable_kdump" not in system.kernel_cmdline_arguments():
                tx += [self.ConfigureKdump()]

            if system.is_pxe():
                tx += [self.ClearNetworkConfig()]

        elif cfg["method"] in ["upgrade", "downgrade", "reinstall"]:
            tx.title = "Update"
            tx += [self.InstallImageAndBootloader()]
            tx += [self.SetKeyboardLayout(cfg["keyboard.layout"])]
            new_password = cfg.get("upgrade.password", None)
            if new_password:
                tx += [self.SetPassword(new_password)]

        self.logger.debug("Built transaction: %s" % tx)

        return tx