From: "Bamvor Jian Zhang" Subject: Re: [PATCH v4 1/5] define snapshot API Date: Tue, 24 Jun 2014 07:39:48 -0600 Message-ID: <53A9F024020000300003D511@soto.provo.novell.com> References: <1403522755-6894-1-git-send-email-bjzhang@suse.com> <1403522755-6894-2-git-send-email-bjzhang@suse.com> <53A9A37A020000660003DB2A@soto.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53A9A37A020000660003DB2A@soto.provo.novell.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org, Chun Yan Liu Cc: Zhiqiang Zhou , ian.campbell@citrix.com, ian.jackson@eu.citrix.com, Jim Fehlig , anthony.perard@citrix.com, davidkiarie4@gmail.com List-Id: xen-devel@lists.xenproject.org Hi, Chunyan > >>> On 6/23/2014 at 07:25 PM, in message > <1403522755-6894-2-git-send-email-bjzhang@suse.com>, Bamvor Jian Zhang > wrote: > > it includes two parts APIs: domain snapshot configuration file operation > > (load, store, delete, it base on Wei Liu's libxl-json api) and disk > > snapshot operation(create, delete, revert, including implementation > > details: choose qmp or qemu-img command). > > > > about xl and libvirt cooperation. currently, libvirt use xml for description > > domain snapshot for both user interface and store the snapshot information > > on disks. if libvirt libxl driver could use libxl-json format in load/store > > domain snapshot configuration, it would be easier for the user who may be > > switch xl and libvirt. this will not affect the libvirt user experience. > > > > Signed-off-by: Bamvor Jian Zhang > > --- > > tools/libxl/libxl.h | 37 +++++++++++++++++++++++++++++++++++++ > > 1 file changed, 37 insertions(+) > > > > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > > index be722b6..8106f4b 100644 > > --- a/tools/libxl/libxl.h > > +++ b/tools/libxl/libxl.h > > @@ -1261,6 +1261,43 @@ int libxl_load_domain_configuration(libxl_ctx *ctx, > > uint32_t domid, > > int libxl_store_domain_configuration(libxl_ctx *ctx, uint32_t domid, > > libxl_domain_config *d_config); > > > > +/* snapshot relative APIs */ > > + > > +/* management functions for domain snapshot configuration */ > > + > > +/* Load, save, delete domain snapshot configuration file. */ > > +int libxl_load_dom_snapshot_conf(libxl_ctx *ctx, uint32_t domid, > > + libxl_domain_snapshot *snapshot); > > +int libxl_store_dom_snapshot_conf(libxl_ctx *ctx, uint32_t domid, > > + libxl_domain_snapshot *snapshot); > > +int libxl_delete_dom_snapshot_conf(libxl_ctx *ctx, uint32_t domid, > > + libxl_domain_snapshot *snapshot); > > Do we need libxl_domain_snapshot as parameter here? Why not > 'ctx, domid, snapshot-name'? yes, i only need the name of snapshot for deleting. i put libxl_domain_snapshot here in order to consistent with load and store functions above. > > > + > > +/* retrieve all the snapshot information from disk, put the number of it to > > num. > > Typo here. Is it to retrieve the snapshot info of the domain? > If domain has 2 snapshots, return the 2 snapshots' info and set num=2. yes. thanks. > > > + * caller is responsible for free the libxl_domain_snapshot array. > > + */ > > +libxl_domain_snapshot *libxl_domain_snapshot_list(libxl_ctx *ctx, > > + uint32_t domid, int > > *num); > > + > > +/* functions for disk snapshot operations */ > > +/* create disk snapshot through qmp transaction */ > > +int libxl_disk_snapshot_create(libxl_ctx *ctx, int domid, > > + libxl_disk_snapshot *snapshot, int nb); > > + > > +/* delete disk snapshot through qmp delete */ > > +int libxl_disk_snapshot_delete(libxl_ctx *ctx, int domid, > > + libxl_disk_snapshot *snapshot, int nb); > > + > > +/* revert disk snapshot through qemu-img snapshot apply command */ > > +int libxl_disk_snapshot_revert(libxl_ctx *ctx, uint32_t domid, > > + libxl_disk_snapshot *snapshot, int nb); > > + > > +/* create libxl_disk_snapshot from libxl_device_disk > > + * will alloc disks if disks empty > > + */ > > +int libxl_disk_to_snapshot(libxl_ctx *ctx, uint32_t domid, > > + libxl_domain_snapshot *snapshot); > > What is this function for? And how would we use it? It's better to have some > explanation to the functionality and the parameters. sorry for confuse. this function will save disk parameter to libxl_disk_snapshot from libxl_diskinfo. reference my next reply for structure definition. libxl_disk_to_snapshot will get disk list through libxl_device_disk_list, and get libxl_diskinfo through libxl_device_disk_getinfo. and it will only process the disk support snapshot in current implementaiton. e.g. for internal snapshot: only qcow2 is supported. for external snapshot: raw and qcow2 is supported. regards bamvor