[lxc-devel] [RFC 1/1] snapshots in api: define lxcapi_snapshot

Serge Hallyn serge.hallyn at ubuntu.com
Wed Sep 4 17:30:23 UTC 2013


> In addition, I'll add lxcapi_snapshot_destroy(), which will look like:
> 
> 	c = lxc_container_new("c0", "/var/lib/lxc");
> 	c->snapshot_destroy(c, "snap1");
> 	lxc_container_put(c);
> 
> As for snapshot_list, I'm thinking it will just look like:
> 
> 	c = lxc_container_new("c0", "/var/lib/lxc");
> 	ns = c->snapshot_entries(c, NULL, 0);
> 	for (i=0; i<ns; i++) {
> 		c2 = c->get_snapshot(c, i);
> 		printf("name is %s, lxcpath %s\n", c->name, c->config_path);
> 		lxc_container_put(c2);
> 	}
> 	lxc_container_put(c);
> 
> with 'timestamp' and 'comment_file' fields being added to struct
> container_struct, usually both NULL.

No, I guess it's better to have a

	struct lxc_snapshot {
		// restore the container as a real container in lxcpath
		struct lxc_container *(*restore)(char *name);
		char *(*get_comment)(void);
		char *(*timestamp)(void);
		// return a lxc_container for the snapshot itself
		struct lxc_container *(*open)(void);
		bool (*destroy)(void);
	};





More information about the lxc-devel mailing list