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 __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
#set NFSv4 domain if "OVIRT_NFSV4_DOMAIN" in OVIRT_VARS and \ not OVIRT_VARS["OVIRT_NFSV4_DOMAIN"] is "": tx.append(ConfigureNfsv4()) tx.append(ConfigureLogging()) if not SystemRelease().is_el(): tx.append(ConfigureCollectd()) tx.append(PerformInstallation()) # FIXME needed?? tx.append(ConfigureKdump()) if not is_stateless(): tx.append(InstallBootloader()) tx.append(RunHooks()) TransactionProgress(tx, is_dry=False).run() print "Installation and Configuration Completed" reboot_delay = kernel_cmdline_arguments().get("reboot_delay", None) if reboot_delay: print "Reboot Scheduled in %s seconds later" % reboot_delay time.sleep(int(reboot_delay)) os.system(which("reboot")) # python will exit with 1 if an exception occurs
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. A copy of the GNU General Public License is # also available at http://www.gnu.org/copyleft/gpl.html. from ovirt.node.utils.console import TransactionProgress from ovirt.node.setup.cim import cim_model from ovirt.node.utils import system args = system.kernel_cmdline_arguments() if __name__ == "__main__": cim = cim_model.CIM() if "cim_passwd" in args and len(args["cim_passwd"]) > 0: cim.update(enabled=True) tx = cim.transaction(cim_password=args["cim_passwd"]) TransactionProgress(tx, is_dry=False).run() # clear ovirt_cim_passwd from /etc/default/ovirt pw_keys = ("OVIRT_CIM_PASSWD") cim.clear(keys=pw_keys)
# set NFSv4 domain if "OVIRT_NFSV4_DOMAIN" in OVIRT_VARS and \ not OVIRT_VARS["OVIRT_NFSV4_DOMAIN"] is "": tx.append(ConfigureNfsv4()) tx.append(ConfigureLogging()) if not SystemRelease().is_el(): tx.append(ConfigureCollectd()) tx.append(PerformInstallation()) # FIXME needed?? tx.append(ConfigureKdump()) if not is_stateless(): tx.append(InstallBootloader()) tx.append(RunHooks()) TransactionProgress(tx, is_dry=False).run() print "Installation and Configuration Completed" reboot_delay = kernel_cmdline_arguments().get("reboot_delay", None) if reboot_delay: print "Reboot Scheduled in %s seconds later" % reboot_delay time.sleep(int(reboot_delay)) os.system(which("reboot")) # python will exit with 1 if an exception occurs