def execute_restore(self, context, backup_info, restore_location): try: LOG.debug("Getting Restore Runner %(type)s.", backup_info) restore_runner = self._get_restore_runner(backup_info['type']) LOG.debug("Getting Storage Strategy.") storage = get_storage_strategy( CONF.storage_strategy, CONF.storage_namespace)(context) runner = restore_runner(storage, location=backup_info['location'], checksum=backup_info['checksum'], restore_location=restore_location) backup_info['restore_location'] = restore_location LOG.debug("Restoring instance from backup %(id)s to " "%(restore_location)s.", backup_info) content_size = runner.restore() LOG.debug("Restore from backup %(id)s completed successfully " "to %(restore_location)s.", backup_info) LOG.debug("Restore size: %s.", content_size) except Exception: LOG.exception(_("Error restoring backup %(id)s."), backup_info) raise else: LOG.debug("Restored backup %(id)s.", backup_info)
def execute_restore(self, context, backup_info, restore_location): try: LOG.debug("Getting Restore Runner %(type)s.", backup_info) restore_runner = self._get_restore_runner(backup_info['type']) LOG.debug("Getting Storage Strategy.") storage = get_storage_strategy( CONF.storage_strategy, CONF.storage_namespace)(context) runner = restore_runner(storage, location=backup_info['location'], checksum=backup_info['checksum'], restore_location=restore_location) backup_info['restore_location'] = restore_location LOG.debug("Restoring instance from backup %(id)s to " "%(restore_location)s.", backup_info) content_size = runner.restore() LOG.debug("Restore from backup %(id)s completed successfully " "to %(restore_location)s.", backup_info) LOG.debug("Restore size: %s.", content_size) except Exception: LOG.exception(_("Error restoring backup %(id)s.") % backup_info) raise else: LOG.debug("Restored backup %(id)s." % backup_info)
def execute_backup(self, context, backup_info, runner=RUNNER, extra_opts=EXTRA_OPTS, incremental_runner=INCREMENTAL_RUNNER): LOG.debug("Running backup %(id)s.", backup_info) storage = get_storage_strategy( CONF.storage_strategy, CONF.storage_namespace)(context) # Check if this is an incremental backup and grab the parent metadata parent_metadata = {} if backup_info.get('parent'): runner = incremental_runner LOG.debug("Using incremental backup runner: %s.", runner.__name__) parent = backup_info['parent'] parent_metadata = storage.load_metadata(parent['location'], parent['checksum']) # The parent could be another incremental backup so we need to # reset the location and checksum to *this* parents info parent_metadata.update({ 'parent_location': parent['location'], 'parent_checksum': parent['checksum'] }) self.stream_backup_to_storage(context, backup_info, runner, storage, parent_metadata, extra_opts)