[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC V5 4/5] xl snapshot-xxx implementation details

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
    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
        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
    2), delete snapshot and other related files/state mentioned in above config
        (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

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.


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).

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.