The freezer.engine.engine Module

The freezer.engine.engine Module

  1. Copyright 2014,2015 Hewlett-Packard Development Company, L.P.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class freezer.engine.engine.BackupEngine(storage)

Bases: object

The main part of making a backup and making a restore is the mechanism of implementing it. For a long time Freezer had only one mechanism of doing it - invoking gnutar and it was heavy hard-coded.

Currently we are going to support many different approaches. One of them is rsync. Having many different implementations requires to have an abstraction level

This class is an abstraction over all implementations.


  1. invoke backup
    1. try to download metadata for incremental
    2. create a dataflow between backup_stream and storage.write_backup Backup_stream is producer of data, for tar backup it creates a gnutar subprocess and start to read data from stdout Storage write_backup is consumer of data, it creates a thread that store data in storage. Both streams communicate in non-blocking mode
    3. invoke post_backup - now it uploads metadata file
  2. restore backup
    1. define all incremental backups
    2. for each incremental backup create a dataflow between storage.read_backup and restore_stream Read_backup is data producer, it reads data chunk by chunk from the specified storage and pushes the chunks into a queue. Restore stream is a consumer, that is actually does restore (for tar it is a thread that creates gnutar subprocess and feeds chunks to stdin of this thread.
backup(backup_resource, hostname_backup_name, no_incremental, max_level, always_level, restart_always_level, queue_size=2)

Here we now location of all interesting artifacts like metadata Should return stream for storing data. :return: stream

backup_data(backup_path, manifest_path)
  • backup_path
  • manifest_path

backup_stream(backup_resource, rich_queue, manifest_path)
  • rich_queue (freezer.streaming.RichQueue) –
  • manifest_path (list[str]) –

Return type:str
Returns:Engine name
read_blocks(backup, write_pipe, read_pipe, except_queue)
restore(hostname_backup_name, restore_resource, overwrite, recent_to_date, backup_media=None)
  • hostname_backup_name
  • restore_path
  • overwrite
  • recent_to_date
restore_level(restore_path, read_pipe, backup, except_queue)
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.