cinder.backup.chunkeddriver module

Generic base class to implement metadata, compression and chunked data operations

class ChunkedBackupDriver(context, chunk_size_bytes, sha_block_size_bytes, backup_default_container, enable_progress_timer)

Bases: BackupDriver

Abstract chunked backup driver.

Implements common functionality for backup drivers that store volume data in multiple “chunks” in a backup repository when the size of the backed up cinder volume exceeds the size of a backup repository “chunk.”

Provides abstract methods to be implemented in concrete chunking drivers.

DRIVER_VERSION = '1.0.0'
DRIVER_VERSION_MAPPING = {'1.0.0': '_restore_v1'}
backup(backup, volume_file, backup_metadata=True)

Backup the given volume.

If backup[‘parent_id’] is given, then an incremental backup is performed.

delete_backup(backup)

Delete the given backup.

abstract delete_object(container, object_name)

Delete object from container.

abstract get_container_entries(container, prefix)

Get container entry names.

abstract get_extra_metadata(backup, volume)

Return extra metadata to use in prepare_backup.

This method allows for collection of extra metadata in prepare_backup() which will be passed to get_object_reader() and get_object_writer(). Subclass extensions can use this extra information to optimize data transfers. Return a json serializable object.

abstract get_object_reader(container, object_name, extra_metadata=None)

Returns a reader object for the backed up chunk.

The object reader methods must not have any logging calls, as eventlet has a bug (https://github.com/eventlet/eventlet/issues/432) that would result in failures.

abstract get_object_writer(container, object_name, extra_metadata=None)

Returns a writer object which stores the chunk data.

The object returned should be a context handler that can be used in a “with” context.

The object writer methods must not have any logging calls, as eventlet has a bug (https://github.com/eventlet/eventlet/issues/432) that would result in failures.

abstract put_container(container)

Create the container if needed. No failure if it pre-exists.

restore(backup, volume_id, volume_file, volume_is_new)

Restore the given volume backup from backup repository.

Raises BackupRestoreCancel on any backup status change.

abstract update_container_name(backup, container)

Allow sub-classes to override container name.

This method exists so that sub-classes can override the container name as it comes in to the driver in the backup object. Implementations should return None if no change to the container name is desired.