- 1 QEMU guest-assisted snapshotting
- 1.1 Related blueprints
- 1.2 Goals
- 1.3 Prerequisites
- 1.4 Overview
- 1.5 Related Notes
- 1.6 API Details
- 1.6.1 New APIs
- 1.6.2 Snapshot creation
- 1.6.3 Snapshot deletion
QEMU guest-assisted snapshotting
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:
- User calls new nova API call to execute an assisted snapshot
- Nova will quiesce guest (use existing pause functionality if guest assisted quiesce is not available)
- Nova will execute snapshot API call in Cinder for each Cinder Volume
- Cinder creates snapshot(s)
- 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
- Some examples on libvirt's blockcommit and blockpull -- http://kashyapc.fedorapeople.org/virt/lc-2012/snapshots-handout.html
- More notes on libvirt qcow2 based block operations -- http://kashyapc.fedorapeople.org/virt/lc-2012
new volume_actions 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: volume_id created_at display_name (maybe?) display_description (optional?) size
- Leave snapshot in "creating" status - This will be implemented as a volume_action
new snapshot_actions module to be added, similar to volume_actions
new snapshot_actions API "finalize-snapshot-metadata"
- Finalize snapshot creation process, set status to available or failed - This will be implemented as a volume_action
new snapshot_actions 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
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 Create a Cinder snapshot for each volume (cinder create-snapshot-metadata API call) Call libvirt create-snapshot-as for each local file (on Gluster volume) Finalize Cinder snapshot for each volume (cinder finalize-snapshot-metadata API call) For other attached Cinder volumes, call Cinder snapshot API Done
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
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