The cinder.backup.drivers.ceph Module

Ceph Backup Service Implementation.

This driver supports backing up volumes of any type to a Ceph object store. It is also capable of detecting whether the volume to be backed up is a Ceph RBD volume and, if so, attempts to perform incremental/differential backups.

Support is also included for the following in the case of a source volume being a Ceph RBD volume:

  • backing up within the same Ceph pool (not recommended)
  • backing up between different Ceph pools
  • backing up between different Ceph clusters

At the time of writing, differential backup support in Ceph/librbd was quite new so this driver accounts for this by first attempting differential backup and falling back to full backup/copy if the former fails. It is recommended that you upgrade to Ceph Dumpling (>= v0.67) or above to get the best results.

If incremental backups are used, multiple backups of the same volume are stored as snapshots so that minimal space is consumed in the object store and restoring the volume takes a far reduced amount of time compared to a full copy.

Note that Cinder supports restoring to a new volume or the original volume the backup was taken from. For the latter case, a full copy is enforced since this was deemed the safest action to take. It is therefore recommended to always restore to a new volume (default).

class CephBackupDriver(context, db_driver=None, execute=None)

Bases: cinder.backup.driver.BackupDriver

Backup Cinder volumes to Ceph Object Store.

This class enables backing up Cinder volumes to a Ceph object store. Backups may be stored in their own pool or even cluster. Store location is defined by the Ceph conf file and service config options supplied.

If the source volume is itself an RBD volume, the backup will be performed using incremental differential backups which should give a performance gain.

backup(backup, volume_file, backup_metadata=True)

Backup volume and metadata (if available) to Ceph object store.

If the source volume is an RBD we will attempt to do an incremental/differential backup, otherwise a full copy is performed. If this fails we will attempt to fall back to full copy.

static backup_snapshot_name_pattern()

Returns the pattern used to match backup snapshots.

It is essential that snapshots created for purposes other than backups do not have this name format.

delete(backup)

Delete the given backup from Ceph object store.

classmethod get_backup_snaps(rbd_image, sort=False)

Get all backup snapshots for the given rbd image.

NOTE: this call is made public since these snapshots must be deleted
before the base volume can be deleted.
restore(backup, volume_id, volume_file)

Restore volume from backup in Ceph object store.

If volume metadata is available this will also be restored.

class VolumeMetadataBackup(client, backup_id)

Bases: object

exists
get()

Get metadata backup object.

Returns None if the object does not exist.

name
remove_if_exists()
set(json_meta)

Write JSON metadata to a new object.

This should only be called once per backup. Raises VolumeMetadataBackupExists if the object already exists.

get_backup_driver(context)