[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [RFC V9 4/4] domain snapshot design: libxl/libxlu
>>> On 12/17/2014 at 10:09 PM, in message <20141217140958.GH1904@xxxxxxxxxxxxxxxxxxxxx>, Wei Liu <wei.liu2@xxxxxxxxxx> wrote: > On Tue, Dec 16, 2014 at 02:32:57PM +0800, Chunyan Liu wrote: > > Changes to V8: > > * remove libxl_domain_snapshot_create/delete/revert API > > * export disk snapshot functionality for both xl and libvirt usage > > > > =========================================================================== > > Libxl/libxlu Design > > > > 1. New Structures > > > > libxl_disk_snapshot = Struct("disk_snapshot",[ > > # target disk > > ("disk", libxl_device_disk), > > > > # disk snapshot name > > ("name", string), > > > > # internal/external disk snapshot? > > ("external", bool), > > > > # for external disk snapshot, specify following two field > > ("external_format", string), > > ("external_path", string), > > ]) > > > > So you don't propose making libxl to have knowledge of the snapshot > chains? Right. > And in libvirt (or other toolstack that's interested in snapshot > management) you represent a snapshot as chains (or trees) of > libxl_disk_snapshot? (Not suggesting you do things the other way around, > just to confirm) Libvirt has its own data structure to manage domain snapshots. libxl_disk_snapshot is only used by libvirt to call libxl API to do disk snapshot work for it. In libvirt, it has other data structure to represent disk snapshot information. > > > > > 2. New Functions > > > > Since there're already APIs for saving memory (libxl_domain_suspend) > > and restoring domain from saved memory (libxl_domain_create_restore), to > > xl domain snapshot tasks, the missing part is disk snapshot functionality. > > And the disk snapshot functionality would be used by libvirt too. > > > > Considering there is qmp handling in creating/deleting disk snapshot, > > will add following new functions to libxl (?): > > > > int libxl_disk_snapshot_create(libxl_ctx *ctx, uint32_t domid, > > libxl_disk_snapshot *snapshot, int nb); > > > > Taking disk snapshots to a group of domain disks according to > > configuration. For qcow2 disk backend type, it will call qmp > > "transaction" command to do the work. For other disk backend types, > > might call other external commands. > > > > Parameters: > > ctx (INPUT): > > context > > domid (INPUT): > > domain id > > snapshot (INPUT): > > array of disk snapshot configuration. Has "nb" members. > > > > libxl_device_disk: > > structure to represent which disk. > > name: > > snapshot name. > > external: > > internal snapshot or external snapshot. > > 'false' means internal disk snapshot. external_format and > > external_path will be ignored. > > 'true' means external disk snapshot, then external_format > > and external_path should be provided. > > external_format: > > Should be provided when 'external' is true. If not provided, > > will use default format proper to the backend file. > > Ignored when 'external' is false. > > external_path: > > Must be provided when 'external' is true. > > Ignored when 'external' is false. > > nb (INPUT): > > number of disks that need to take disk snapshot. > > > > Return: > > 0 on success, -1 on error. > > > > It should return appropriate libxl error code (ERROR_*) on error. Thanks. That's better. > > > > > /* This API might not be used by xl, since xl won't take care of deleting > > * snapshots. But for libvirt, since libvirt manages snapshots and will > > * delete snapshot, this API will be used. > > */ > > int libxl_disk_snapshot_delete(libxl_ctx *ctx, uint32_t domid, > > libxl_disk_snapshot *snapshot, int nb); > > > > Delete disk snapshot of a group of domain disks according to > > configuration. For qcow2 disk backend type, it will call qmp command > > to delete internal disk snapshot. For other disk backend types, might > > call other external commands. > > > > Parameters: > > ctx (INPUT): > > context > > domid (INPUT): > > domain id > > snapshot (INPUT): > > array of disk snapshot configuration. Has "nb" members. > > nb (INPUT): > > number of disks that need to take disk snapshot. > > > > Return: > > 0 on success, -1 on error. > > > > > > int libxl_disk_to_snapshot(libxl_ctx *ctx, uint32_t domid, > > libxl_disk_snapshot **snapshot, int *num); > > > > This is for domain snapshot create. If user doesn't specify disks, > > then by default it will take internal disk snapshot to each domain > > disk. This function will fill libxl_disk_snapshot according to domain > > disks info. > > > > Parameters: > > ctx (INPUT): > > context > > domid (INPUT): > > domain id > > snapshot (OUTPUT): > > array of disk snapshot configuration. > > num (OUTPUT): > > number of disks. > > > > Return: > > 0 on success, -1 on error. > > > > > > > > For disk snapshot revert, no qmp command for that, it always calls > > external commands to finish the work, so put in libxlu (?): > > > > int xlu_disk_snapshot_revert(libxl_disk_snapshot *snapshot, int nb); > > > > IMHO it's fine for this to be in libxl. Calling out to other programs > is fine. OK. Thanks. Then we can put all disk snapshot APIs in libxl. > > Wei. > > > Apply disk snapshot for a group of disks according to configuration. To > > different disk backend types, call different external commands to do > > the work. > > > > Parameters: > > snapshot (INPUT): > > array of disk snapshot configuration. Has "nb" members. > > nb (INPUT): > > number of disks that need to take disk snapshot. > > > > Return: > > 0 on success, -1 on error. > > > > > > > > 3. Simple Architecture View > > > > Creating domain snapshot: > > (* means new functions we will need in libxl/libxlu) > > > > "xl snapshot-create" > > | > > parse configuration ----> libxl_disk_to_snapshot (*) > > | > > saving memory ----> libxl_domain_suspend > > | > > taking disk snapshot ----> libxl_disk_snapshot_create (*) > > | | > > | --> libxl_qmp_disk_snapshot_transaction (*) > > | > > unpause domain ---->libxl_domain_unpause > > | > > End > > > > > > Reverting to a snapshot: > > (* means new functions we will need in libxl/libxlu) > > > > "xl snapshot-revert" > > | > > parse configuration > > | > > destroy domain ---->libxl_domain_destroy > > | > > reverting disk snapshot ----> xlu_disk_snapshot_revert (*) > > | | > > | --> call 'qemu-img' to apply disk snapshot > > | > > restore domain from saved memory ----> libxl_domain_create_restore > > | > > End > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |