[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC V8 3/3] xl snapshot-xxx Design
Changes to V7: * change wrong libxl_domain_snapshot_info naming to xl_domain_snapshot_info * remove all disk-only syntax * update xl snapshot-revert implementaion =========================================================================== 1. xl commandline interface design xl snapshot-create: Create a snapshot (disk and RAM) of a domain. SYNOPSIS: snapshot-create <domain> [<cfgfile>] [--name <string>] [--live] OPTIONS: --name <string> snapshot name --live take a live snapshot 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 doens't include --name, a default name will be generated according to the creation time. If specify @cfgfile, cfgfile is prioritized. (e.g. if --name specifies a name, meanwhile there is name info in cfgfile, name in cfgfile will be used.) xl snapshot-delete: Delete a snapshot (disk and RAM) of a domain. SYNOPSIS: snapshot-delete <domain> <snapshotname> [--children] [--children-only] By default, just this snapshot is deleted, and changes from this snapshot are automatically merged into children snapshots. OPTIONS: --children delete snapshot and all children --children-only delete children but not snapshot If option includes --children, then this snapshot and any descendant snapshots are deleted. If option include --children-only, only descendant snapshots are deleted, this snapshot is not deleted. xl snapshot-revert: Revert domain to status of a snapshot. SYNOPSIS: snapshot-revert <domain> <snapshotname> [--running] [--paused] [--force] OPTIONS: --running after reverting, change state to running --paused after reverting, change state to paused --force try harder on risky reverts Normally, the domain will revert to the same state the domain was in while the snapshot was taken (whether running, or paused). If option includes --running, then overrides the snapshot state to guarantee a running domain after the revert. If option includes --paused, then guarantees a paused domain after the revert. xl snapshot-list: List snapshots for a domain. SYNOPSIS: snapshot-list <domain> [--parent] [--internal] [--external] [--tree] [--name] OPTIONS: --internal filter by internal snapshots --external filter by external snapshots --tree list snapshots in a tree --parent add a column showing parent snapshot --name list snapshot names only 2. cfgfile syntax "xl snapshot-create" supports creating a VM snapshot with user provided configuration file. The configuration file syntax is as below: #snapshot name. If user doesn't provide a VM snapshot name, xl will generate #a name automatically by the creation time. name="" #snapshot description. Default is NULL. description="" #memory location. This field should be filled when memory=1. Default is NULL. memory_path="" #disk snapshot information disks=['sda,1,qcow2,/tmp/sda_snapshot.qcow2','sdb,1,qcow2,/tmp/sda_snapshot.qcow2'] or disks=['sda,0','sdb,0'] disk syntax: 'target device, external disk snapshot?, external format, external path' 3. xl structure to maintain VM snapshot info xl_domain_snapshot_info = Struct("domain_snapshot_info",[ # snapshot name ("name", string) ("create_time", string) ("description", string) # memory path and disk snapshot info ("snapshot_args", libxl_domain_snapshot_args), # parent snapshot name ("parent", string), # array to store all children snapshot name ("children", Array(string, "num_children"), ] According to xl_domain_snapshot_info, a json file will be saved on disk. 4. xl snapshot-xxx implementation details "xl snapshot-create" 1), parse args or domain snapshot configuration file. 2), fill info in libxl_domain_snapshot_args struct according to options or config file. 3), call libxl_domain_snapshot_create() 4), fill info in xl_domain_snapshot_info. 5), save snapshot info in json file under "/var/lib/xen/snapshots/domain_uuid" "xl snapshot-list" 1), read all domain snapshot related json file under "/var/lib/xen/snapshots/domain_uuid". Parse each file and fill in xl_domain_snapshot_info struct. 2), display information from those xl_domain_snapshot_info(s) "xl snapshot-delete" 1), read snapshot json file from "/var/lib/xen/snapshots/domain_uuid/snapshotdata-<snapshot_name>\ .libxl-json", parse the file and fill in xl_domain_snapshot_info 2), according to parent/children info in xl_domain_snapshot_info and commandline options, decide which domain snapshot to be deleted. To delete each domain snapshot, fill in libxl_domain_snapshot_args and call libxl_domain_snapshot_delete(). 3), refresh parent/children relationship, delete json file for those already deleted snapshot. "xl snapshot-revert" 1), read snapshot json file from "/var/lib/xen/snapshots/domain_uuid/snapshotdata-<snapshot_name>\ .libxl-json", parse the file and fill in xl_domain_snapshot_info. 2), destroy current domain 3). according to the info in xl_domain_snapshot_info, create a new domain from snapshot. Interact with other operations: All snapshots should be deleted before deleting a domain. This will affact xl destroy/shutdown/save/migrate, adding related check and error reporting. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |