The cinder.backup.driver Module

Base class for all backup drivers.

class BackupDriver(context, db_driver=None)

Bases: cinder.db.base.Base

backup(backup, volume_file, backup_metadata=False)

Start a backup of a specified volume.

delete(backup)

Delete a saved backup.

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 overwrite this method and return it here 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)
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 overwrite 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:

nothing

put_metadata(volume_id, json_metadata)
restore(backup, volume_id, volume_file)

Restore a saved backup.

class BackupDriverWithVerify(context, db_driver=None)

Bases: cinder.backup.driver.BackupDriver

verify(backup)

Verify that the backup exists on the backend.

Verify that the backup is OK, possibly following an import record operation.

Parameters:backup – backup id of the backup to verify
Raises:InvalidBackup, NotImplementedError
class BackupMetadataAPI(context, db_driver=None)

Bases: cinder.db.base.Base

TYPE_TAG_VOL_BASE_META = 'volume-base-metadata'
TYPE_TAG_VOL_GLANCE_META = 'volume-glance-metadata'
TYPE_TAG_VOL_META = 'volume-metadata'
get(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.

put(volume_id, json_metadata)

Restore volume metadata to a volume.

The json container should contain a version that is supported here.