Jump to: navigation, search


< Cinder
Revision as of 10:59, 17 July 2013 by Dripton (talk | contribs) (typo)

QEMU guest-assisted snapshotting

Related blueprints


1. Add snapshot support for Cinder backing stores which lack internal snapshots (NFS, Gluster, etc.)


  • QEMU/libvirt live snapshot support
  • QEMU guest agent installed (for quiescing)


Currently, GlusterFS + Cinder does not support snapshots. Snapshot support can be enabled by storing volume data as QCOW2 files on Cinder volumes rather than as flat raw files (as is done today), and leveraging QCOW2's snapshot functionality.

Creation of Snapshot:

  1. User calls new nova API call to execute an assisted snapshot
  2. Nova will quiesce guest (use existing pause functionality if guest assisted quiesce is not available)
  3. Nova will execute snapshot API call in Cinder for each Cinder Volume
  4. Cinder creates snapshot(s)
  5. Nova resumes VM on completion of the snapshot(s)

The snapshot can then be managed like any other Cinder snapshot.

Changes required for Cinder QCOW2 volumes:

  • Cinder code to create them (per-driver code & options)
  • Cinder code to translate/process them for operations like upload-to-image, backup_create, clone
  • Possibly DB information tracking type (qcow2 or raw) - if needed

Related Notes

API Details

New APIs


new API "create-snapshot-metadata" (Note: this may actually need to be two APIs, or use different parameters to specify "creating" vs "done, created successfully".)

- Allow creation of a snapshot by providing metadata rather than Cinder creating snapshot. (i.e. it was created by Nova.)  Cinder driver snapshot code is not called.
- Metadata:
            display_name (maybe?)
            display_description (optional?)

- Leave snapshot in "creating" status - This will be implemented as a volume_action

new API "finalize-snapshot-metadata" - Finalize snapshot creation process, set status to available or failed - This will be implemented as a volume_action

new API "snapshot-delete-metadata"

- Deletes a snapshot without performing any real storage operation
- Is this needed?  Maybe not if the GlusterFS driver's snapshot-delete is smart enough.


 New API to create snapshots of multiple volumes
  - Allow "all volumes" or a subset of volumes to be specified
  - Available via nova client CLI

Snapshot creation

Currently, it is assumed that file names are: volume-<UUID> for the original volume (as is done today), and volume-<UUID>.<snap-UUID> where snap-UUID is the snapshot which depends directly on this qcow2 file as a backing file. The offline Cinder case works this way, ideally Nova can match the same behavior.

Case 1: Nova-driven snaps (attached)


  Create multiple-snapshots Nova API called, specifying which volumes, or all volumes
    Determine which volumes are local files, which are iSCSI/FC-attached
    Call libvirt create-snapshot-as for each local file (on Gluster volume)
    For other attached Cinder volumes, call Cinder snapshot API
    Create a Cinder snapshot for each snapshot created (cinder create-snapshot-from-metadata API call)

Case 2: Cinder-driven snapshot

 Only works if volume not attached
 create-snapshot goes through GlusterFS driver like a typical Cinder driver snapshot
 Snapshot created via qemu-img manipulation

Snapshot deletion

Case 1: Nova-driven (attached)

Nova (method 1 - should work today):

 Create libvirt snapshot from metadata retrieved from Cinder
 Call libvirt blockpull operation (merge base into snapshot)
 Rename snapshot file to previous base name (libvirt operation: ?)
 Delete snapshot from Cinder (snapshot-delete-metadata, or maybe just snapshot-delete)

Nova (method 2 - more efficient, may not work today):

 Create libvirt snapshot from metadata retrieved from Cinder
 Call libvirt blockcommit operation (merge snapshot into base)
   - In current (or at least recent) libvirt, live blockcommit is not supported.  Should be added in the future.
 Delete snapshot from Cinder (snapshot-delete-metadata, or maybe just snapshot-delete)

Case 2: Cinder-driven

 Only works if volume not attached
 Delete via qemu-img manipulation, works like a typical Cinder driver