Jump to: navigation, search

Cinder/GuestAssistedSnapshotting

< Cinder
Revision as of 16:32, 23 July 2013 by Eharney (talk | contribs) (Overview: clarify Creation of Snapshot)

QEMU guest-assisted snapshotting

Related blueprints

Goals

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

Prerequisites

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

Overview

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 calls Cinder's create-snapshot-metadata call for each volume
  3. Nova will quiesce and snapshot guest through libvirt create_snapshot
  4. Based on that result, call Cinder's finalize-snapshot-metadata call for each snapshot
  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 (does not seem to be needed)

Related Notes


API Details

New APIs

Cinder

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.

Nova

 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)

Nova:

  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

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