The cinder.interface.backup_driver Module

Core backup driver interface.

All backup drivers should support this interface as a bare minimum.

class BackupDriver

Bases: cinder.interface.base.CinderInterface

Backup driver required interface.

backup(backup, volume_file, backup_metadata=False)

Start a backup of a specified volume.

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

If the parent backup is of different size, a full backup should be performed to ensure all data is included.

TODO(smcginnis) Document backup variable structure.

Parameters:
  • backup – The backup information.
  • volume_file – The volume or file to write the backup to.
  • backup_metadata – Whether to include volume metadata in the backup.
delete(backup)

Delete a backup from the backup store.

Parameters:backup – The backup to be deleted.
export_record(backup)

Export driver specific backup record information.

If backup backend needs additional driver specific information to import backup record back into the system it must override this method and return it as a dictionary so it can be serialized into a string.

Default backup driver implementation has no extra information.

Parameters:backup – backup object to export
Returns:driver_info - dictionary with extra information
get_metadata(volume_id)

Get volume metadata.

Returns a json-encoded dict containing all metadata and the restore version i.e. the version used to decide what actually gets restored from this container when doing a backup restore.

Typically best to use py:class:BackupMetadataAPI for this.

Parameters:volume_id – The ID of the volume.
Returns:json-encoded dict of metadata.
import_record(backup, driver_info)

Import driver specific backup record information.

If backup backend needs additional driver specific information to import backup record back into the system it must override this method since it will be called with the extra information that was provided by export_record when exporting the backup.

Default backup driver implementation does nothing since it didn’t export any specific data in export_record.

Parameters:
  • backup – backup object to export
  • driver_info – dictionary with driver specific backup record information
Returns:

None

put_metadata(volume_id, json_metadata)

Set volume metadata.

Typically best to use py:class:BackupMetadataAPI for this.

Parameters:
  • volume_id – The ID of the volume.
  • json_metadata – The json-encoded dict of metadata.
restore(backup, volume_id, volume_file)

Restore volume from a backup.

Parameters:
  • backup – The backup information.
  • volume_id – The volume to be restored.
  • volume_file – The volume or file to read the data from.