freezer.engine.engine module

freezer.engine.engine module

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.

Workflow:

  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)
Parameters:
  • backup_path
  • manifest_path
Returns:

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

metadata(backup_resource)
name
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)
Parameters:
  • 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.