xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Chunyan Liu <cyliu@suse.com>
To: xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, jfehlig@suse.com, Ian.Jackson@eu.citrix.com,
	ian.campbell@citrix.com, Chunyan Liu <cyliu@suse.com>
Subject: [RFC Doc V11 3/5] domain snapshot xl design
Date: Tue, 11 Aug 2015 18:44:15 +0800	[thread overview]
Message-ID: <1439289856-27802-4-git-send-email-cyliu@suse.com> (raw)
In-Reply-To: <1439289856-27802-1-git-send-email-cyliu@suse.com>


XL Design

1. User Interface

xl snapshot-create:
  Create a snapshot (disk and RAM) of a domain.

  SYNOPSIS:
    snapshot-create [--live] [--internal|--external] [--path=path] <Domain>
                    [<ConfigFile>]
  OPTIONS:
    -l,--live        take a live snapshot
    -i,--internal    take internal disk snapshots to all disks
    -e,--external    take external disk snapshots to all disks
    -p,--path        path to store snapshot data

    If no options specified and no @ConfigFile specified:
    e.g. # xl snapshot-create domain
    By default, it will create a domain snapshot with default name
    generated according to creation time. This name will be used to
    generate default RAM snaphsot name and disk snapshot name, and
    generate the default directory to store all the snapshot data
    (RAM snapshot file, external disk snapshot files, etc.)
    e.g. result of above command would be:
    default snapshot root directory:
        /var/lib/xen/snapshots/
    default snapshot name generated :
        20150122xxx
    default subdirectory to save data of this snapshot:
        /var/lib/xen/snapshots/domain_uuid/20150122xxx/
    RAM snapshot file:
        By default, it will save memory. Location is here:
        /var/lib/xen/snapshots/domain_uuid/20150122xxx/20150122xxx.save
    disk snapshots:
        By default, to each domain disk, take internal disk snapshot if
        that disk supports, otherwise, take external disk snapshot.

        Internal disk snapshot: take disk snapshot with name 20150122xxx
        External disk snapshot: external file is:
        /var/lib/xen/snapshots/domain_uuid/20150122xxx/vda_20150122xxx.qcow2
        /var/lib/xen/snapshots/domain_uuid/20150122xxx/vdb_20150122xxx.qcow2

    If option includes --live, then the domain is not paused while creating
    the snapshot, like live migration. This increases size of the memory
    dump file, but reducess downtime of the guest.

    If option includes --path, all snapshot data will be saved in this @path.
    If no @ConfigFile:name specified, then use default name (generated by
    time).

    User could specify snapshot information in details through @ConfigFile,
    see following ConfigFile syntax. If configuration in @ConfigFile conflicts
    with options, use options.


xl snapshot-revert:
  Revert domain to status of a snapshot.

  SYNOPSIS:
    snapshot-revert [--pause] [--force] <Domain> <ConfigFile>

  OPTIONS:
    -p,--pause    keep domain paused after the revert
    -f,--force    try harder on risky revert


About domain snapshot delete:
    xl doesn't have snapshot chain information, so it couldn't do the full work.
    If supply:
      xl snapshot-delete <domain> <cfgfile>
    For internal disk snapshot, deleting disk snapshot doesn't need snapshot 
    chain info, this commands can finish the work. But for external disk snapshot,
    deleting disk snapshot will need to merge backing file chain, then will need
    the backing file chain information, this command can not finish that.

    So, deleting domain snapshots will be left to user:

    user could delete RAM snapshots and disk snapshots by themselves:
    RAM snapshot file: user could remove it directly.
    Disk snapshots:
      - Internal disk snapshot, issue 'qemu-img snapshot -d'
      - External disk snapshot, basically it is implemented as backing file chain.
        Use 'qemu-img commit' to remove one file from the chain and merge its data
        forward.        


2. cfgfile syntax

# snapshot name. If user doesn't provide a VM snapshot name, xl will generate
# a name automatically by creation time or by @path basename.
name=""

# save memory or disk-only.
# If memory is '0', doesn't save memory, take disk-only domain snapshot.
# If memory is '1', domain memory is saved.
# Default if 1.
memory=1

# memory location. This field is valid when memory=1.
# If it is set to "", xl will generate a path by creation time or by @path
# basename.
memory_path=""

# disk snapshot specification
#
# Syntax: 'external path, external format, target device'
#
# By default, if no disks is specified here, it will take disk snapshot
# to all disks: take internal disk snapshot if disk support internal disk
# snapshot; and external disk snapshot to other disks.

#disks=['/tmp/hda_snapshot.qcow2,qcow2,hda', ',,hdb',]


3. xl snapshot-xxx implementation

"xl snapshot-create"

    1), parse args or user configuration file.
    2), if saveing memory: save domain (store saved memory to memory_path)
        if taking disk-only snapshot: pause domain, quiece disks. (not
        supported now, maybe in future.)
    3), create disk snapshots according to disk snapshot configuration
    4), unpause domain

"xl snapshot-revert"

    1), parse user configuration file
    2), destroy current domain
    3), revert disk snapshots according to disk snapshot configuration
    4), restore domain from saved memory.

4. Notes

* user should take care of snapshot data: saved memory file, disk
  snapshots info (internal, external, etc.), snapshot chain relationship
* user should delete snapshots by themselves with CLI commands like: rm,
  qemu-img, etc.

  parent reply	other threads:[~2015-08-11 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 10:44 [RFC Doc V11 0/4] domain snapshot document Chunyan Liu
2015-08-11 10:44 ` [RFC Doc V11 1/5] domain snapshot terms Chunyan Liu
2015-08-11 10:44 ` [RFC Doc V11 2/5] domain snapshot introduction Chunyan Liu
2015-08-11 10:44 ` Chunyan Liu [this message]
2015-08-11 10:44 ` [RFC Doc V11 4/5] domain snapshot libxl design Chunyan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439289856-27802-4-git-send-email-cyliu@suse.com \
    --to=cyliu@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jfehlig@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).