xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bamvor Jian Zhang <bjzhang@suse.com>
To: xen-devel@lists.xen.org
Cc: zzhou@suse.com, ian.campbell@citrix.com, hahn@univention.de,
	ian.jackson@eu.citrix.com, cyliu@suse.com, jfehlig@suse.com,
	bjzhang@suse.com, anthony.perard@citrix.com,
	davidkiarie4@gmail.com
Subject: [RFC V5 4/5] xl snapshot-xxx implementation details
Date: Mon,  7 Jul 2014 15:46:03 +0800	[thread overview]
Message-ID: <1404719164-4983-5-git-send-email-bjzhang@suse.com> (raw)
In-Reply-To: <1404719164-4983-1-git-send-email-bjzhang@suse.com>

xl snapshot-xxx implementation details

Q: Why there is no universe API for domain snapshot?
A: This is my initial target while working on snapshot. with the common API,
   different toolstack(xl or libvirt) could call the same api for the same
   operation. life would be eaiser compare to the domain create, restore and
   ...

   The reason why I could not provide common API is that it is hard to handle
   the ao things in api. e.g. in domain snapshot create, libvirt may wait the
   memory save by waiting the ao complete flag.

   Another reason is that I could share more functions in xl command
   with xl snapshot command if i do not need to provide the common api. share
   the code mean easy to maintenance.

1, "xl snapshot-create"

    1), parse domain snapshot configuration file.
    2), fill all the variable including libxl_disk_snapshot array in
        libxl_domain_snapshot struct according to options or config file.
    3), save domain memory through save_domain if it is not a disk only
        snapshot.
    4), take disk snapshot by calling libxl_disk_snapshot_create() with
        libxl_domain_snapshot struct as parameter.
    5), save snapshot configuration(libxl-json format) to
        "/var/lib/xen/snapshots/domain_uuid/snapshotdata-<snapshot_name>\
        .libxl-json"
        by calling libxl_store_dom_snapshot_conf().

2, "xl snapshot-list"

    1), read all the domain snapshot configuration file(libxl-json format) under
        "/var/lib/xen/snapshots/domain_uuid". Parse each file and fill in
        libxl_domain_snapshot struct.
    2), display short or full information from these libxl_domain_snapshot array
        for one or all snapshots depend on "-n your_snapshot_name" options

3, "xl snapshot-delete"

    1), read snapshot configuration file from
        "/var/lib/xen/snapshots/domain_uuid/snapshotdata-<snapshot_name>\
        .libxl-json"
    2), delete snapshot and other related files/state mentioned in above config
        file.
        (1), delete memory image if it is not a disk only snapshot.
        (2), delete disk snapshot date by calling libxl_disk_snapshot_delete()
        (3), delete domain snapshot configuration by calling
             libxl_delete_dom_snapshot_conf()

4, "xl snapshot-revert"

    1), destroy the running domain by libxl_domain_destroy(). If domain is not
        running, skip this step.
    2), revert disk snapshot by calling libxl_disk_snapshot_revert().
    3), restore domain stae through create_domain functions in xl_cmdimpl.c

    Idealy, I should use libxl__xc_domain_restore for domain memory restore.
    But there will be issue when the domain configuration is different between
    current time and snapshot time. In my current implementation, I destroy
    the current domain, and after reverting disk snapshot restore the domain
    through create_domain with proper dom_info. So, the revert is not pull
    the domain status back. It is different from qemu snapshot implementation,
    qemu is pull the domain back to the snapshot point with loadvm hmp.


NOT DO:

1. non-qdisk backend. (Currently only qcow2 and raw are supported)

   After some discussion with Jim, it seems that the
   snapshot of these devices could be done by difference utils through
   libxl__exec. For tap/tap2, td-util or vhd-util.

   For lvm, snapshot create, delete, revert could be done by lvcreate,
   lvremove, lvconvert respectively.

2. live snapshot.

   I do not know how it should work exactly. If we talk about live memory save,
   I guess it is simialr to live migration. but i am not sure how to sync with
   live memory save and disk transaction(for creating disk snapshot).

  parent reply	other threads:[~2014-07-07  7:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07  7:45 [RFC V5 0/5] domain snapshot document and discussion Bamvor Jian Zhang
2014-07-07  7:46 ` [RFC V5 1/5] docs: libxl Domain Snapshot HOWTO Bamvor Jian Zhang
2014-07-07  7:46 ` [RFC V5 2/5] Libxl Domain Snapshot API Design Bamvor Jian Zhang
2014-07-11 12:47   ` Ian Campbell
2014-07-11 13:19     ` Ian Jackson
2014-07-11 15:43       ` Bamvor Jian Zhang
2014-07-14 14:42     ` Bamvor Jian Zhang
2014-07-14 15:18       ` Ian Campbell
2014-07-16  9:27         ` Bamvor Jian Zhang
2014-07-16  9:50           ` Ian Campbell
2014-07-17  8:02             ` Bamvor Jian Zhang
2014-07-07  7:46 ` [RFC V5 3/5] docs: manpage for xl snapshot command Bamvor Jian Zhang
2014-07-07  7:46 ` Bamvor Jian Zhang [this message]
2014-07-07  7:46 ` [RFC V5 5/5] docs: man page for xl.snapshot.cfg Bamvor Jian Zhang

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=1404719164-4983-5-git-send-email-bjzhang@suse.com \
    --to=bjzhang@suse.com \
    --cc=anthony.perard@citrix.com \
    --cc=cyliu@suse.com \
    --cc=davidkiarie4@gmail.com \
    --cc=hahn@univention.de \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jfehlig@suse.com \
    --cc=xen-devel@lists.xen.org \
    --cc=zzhou@suse.com \
    /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).