cinder.backup.driver module

Base class for all backup drivers.

class BackupDriver(context, db=None)

Bases: cinder.db.base.Base

abstract backup(backup, volume_file, backup_metadata=False)

Start a backup of a specified volume.

Some I/O operations may block greenthreads, so in order to prevent starvation parameter volume_file will be a proxy that will execute all methods in native threads, so the method implementation doesn’t need to worry about that..

check_for_setup_error()

Method for checking if backup backend is successfully installed.

abstract delete_backup(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)
abstract restore(backup, volume_id, volume_file)

Restore a saved backup.

Some I/O operations may block greenthreads, so in order to prevent starvation parameter volume_file will be a proxy that will execute all methods in native threads, so the method implementation doesn’t need to worry about that..

May raise BackupRestoreCancel to indicate that the restoration of a volume has been aborted by changing the backup status.

class BackupMetadataAPI(context, db=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.