def revert_snapshot(self, name):
"""Revert snapshot by name
- Revert a libvirt snapshots for all nodes in the environment
- Try to reload 'config' object from a file 'config_<name>.ini'
If the file not found, then pass with defaults.
- Set <name> as the current state of the environment after reload
:param name: string
"""
if not settings.MAKE_SNAPSHOT_STAGES:
LOG.info("SKIP reverting from snapshot '{0}' "
"because MAKE_SNAPSHOT_STAGES=false".format(name))
return
LOG.info("Reverting from snapshot named '{0}'".format(name))
if self.__env is not None:
self.__env.revert(name=name)
LOG.info("Resuming environment after revert")
self.__env.resume()
else:
raise exceptions.EnvironmentIsNotSet()
try:
test_config_path = self._get_snapshot_config_name(name)
settings_oslo.reload_snapshot_config(self.__config,
test_config_path)
except cfg.ConfigFilesNotFoundError as conf_err:
LOG.error("Config file(s) {0} not found!".format(
conf_err.config_files))
self.__config.hardware.current_snapshot = name
评论列表
文章目录