def create_snapshot(self, name, description=None): """Store environmetn state into the config object - Store the state of the environment <name> to the 'config' object - Save 'config' object to a file 'config_<name>.ini' """ self.__config.hardware.current_snapshot = name settings_oslo.save_config(self.__config, name)
def create_snapshot(self, name, description=None, force=False): """Create named snapshot of current env. - Create a libvirt snapshots for all nodes in the environment - Save 'config' object to a file 'config_<name>.ini' :name: string """ if not settings.MAKE_SNAPSHOT_STAGES and not force: msg = ("[ SKIP snapshot '{0}' because MAKE_SNAPSHOT_STAGES=false ]" " {1}".format(name, description or '')) LOG.info("\n\n{0}\n{1}".format(msg, '*' * len(msg))) return msg = "[ Create snapshot '{0}' ] {1}".format(name, description or '') LOG.info("\n\n{0}\n{1}".format(msg, '*' * len(msg))) self.__config.hardware.current_snapshot = name LOG.info("Set current snapshot in config to '{0}'".format( self.__config.hardware.current_snapshot)) if self.__env is not None: LOG.info('trying to suspend ....') self.__env.suspend() LOG.info('trying to snapshot ....') self.__env.snapshot(name, description=description, force=True) LOG.info('trying to resume ....') self.__env.resume() else: raise exceptions.EnvironmentIsNotSet() settings_oslo.save_config(self.__config, name, self.__env.name) if settings.VIRTUAL_ENV: venv_msg = "source {0}/bin/activate;\n".format( settings.VIRTUAL_ENV) else: venv_msg = "" LOG.info("To revert the snapshot:\n\n" "************************************\n" "{venv_msg}" "dos.py revert {env_name} {snapshot_name};\n" "dos.py resume {env_name};\n" "# dos.py time-sync {env_name}; # Optional\n" "ssh -i {key_file} {login}@{salt_master_host} " "# Optional password: {password}\n" "************************************\n".format( venv_msg=venv_msg, env_name=self._d_env_name, snapshot_name=name, login=settings.SSH_NODE_CREDENTIALS['login'], password=settings.SSH_NODE_CREDENTIALS['password'], salt_master_host=self.__config.salt.salt_master_host, key_file=self.__config.underlay.ssh_key_file))
def create_snapshot(self, name, **kwargs): """Store environmetn state into the config object - Store the state of the environment <name> to the 'config' object - Save 'config' object to a file 'config_<name>.ini' """ if not settings.MAKE_SNAPSHOT_STAGES: msg = ("[ SKIP snapshot '{0}' because MAKE_SNAPSHOT_STAGES=false ]" .format(name)) LOG.info("\n\n{0}\n{1}".format(msg, '*' * len(msg))) return self.__config.hardware.current_snapshot = name settings_oslo.save_config(self.__config, name)
def create_snapshot(self, name, *args, **kwargs): """Create named snapshot of current env. - Create a snapshot for the environment - Save 'config' object to a file 'config_<name>.ini' :name: string """ if not settings.MAKE_SNAPSHOT_STAGES: msg = ("[ SKIP snapshot '{0}' because MAKE_SNAPSHOT_STAGES=false ]" .format(name)) LOG.info("\n\n{0}\n{1}".format(msg, '*' * len(msg))) return LOG.info( "Store INI config (without env snapshot) named '{0}'".format(name)) self.__config.hardware.current_snapshot = name settings_oslo.save_config(self.__config, name, self.__config.hardware.heat_stack_name)
def create_snapshot(self, name, description=None): """Create named snapshot of current env. - Create a libvirt snapshots for all nodes in the environment - Save 'config' object to a file 'config_<name>.ini' :name: string """ LOG.info("Creating snapshot named '{0}'".format(name)) self.__config.hardware.current_snapshot = name LOG.info("current config '{0}'".format( self.__config.hardware.current_snapshot)) if self._env is not None: LOG.info('trying to suspend ....') self._env.suspend() LOG.info('trying to snapshot ....') self._env.snapshot(name, description=description, force=True) LOG.info('trying to resume ....') self._env.resume() else: raise exceptions.EnvironmentIsNotSet() settings_oslo.save_config(self.__config, name, self._env.name)