Exemplo n.º 1
0
        def prepare(self):
            cfg = self.config

            # Data size get's a special handling because it grabs the
            # remaining space
            data_size = cfg.get("storage.data_size", "-1")
            data_size = data_size if int(data_size) >= 0 else "-1"
            self.logger.debug("Using a data_size of %s" % data_size)

            model = defaults.Installation()

            model.install_on(init=[cfg["boot.device.current"]] +
                             cfg["installation.devices"],
                             root_size=cfg["storage.root_size"],
                             efi_size=cfg["storage.efi_size"],
                             swap_size=cfg["storage.swap_size"],
                             logging_size=cfg["storage.logging_size"],
                             config_size=cfg["storage.config_size"],
                             data_size=data_size)

            kbd = defaults.Keyboard()
            kbd.update(self.config["keyboard.layout"])

            vercfg = defaults.ConfigVersion()
            vercfg.set_to_current()
Exemplo n.º 2
0
    def _run(self, migration_func):
        try:
            self.logger.info("Starting config migration")

            # Migrate configs
            migration_func()

            # And set curret runtime version
            cfgver = defaults.ConfigVersion()
            cfgver.set_to_current()

            self.logger.info("Config migration finished (to %s)" %
                             cfgver.retrieve()["ver"])
        except:
            self.logger.exception("Config migration failed")
Exemplo n.º 3
0
    def _determine_migration_func(self):
        """Determins if a migration and which migration is necessary
        """
        migration_func = None

        cfgver = defaults.ConfigVersion().retrieve()["ver"]

        if not Config().exists("/etc/default/ovirt"):
            # If the cfg file is not persisted, then this is probably
            # a fresh installation, no migration needed
            self.logger.info("No migration needed during installation")

        elif cfgver is None:
            # config is persisted, but no version set, we assume it is an
            # update from pre ovirt-node-3 to ovirt-node-3
            def importConfigs():
                self.logger.info("Assuming pre ovirt-node-3.0 config")
                ImportConfigs().translate_all()

            migration_func = importConfigs

        return migration_func
 def commit(self):
     defaults.ConfigVersion().set_to_current()