[libvirt] [PATCH 2/6] Snapshot internal methods.
Daniel Veillard
veillard at redhat.com
Sat Apr 3 04:10:40 UTC 2010
On Fri, Apr 02, 2010 at 09:45:57PM -0400, Chris Lalancette wrote:
> Signed-off-by: Chris Lalancette <clalance at redhat.com>
[...]
> +char *virDomainSnapshotDefFormat(char *domain_uuid,
> + virDomainSnapshotDefPtr def,
> + int internal)
> +{
> + virBuffer buf = VIR_BUFFER_INITIALIZER;
> +
> + virBufferAddLit(&buf, "<domainsnapshot>\n");
> + virBufferVSprintf(&buf, " <name>%s</name>\n", def->name);
> + if (def->description)
> + virBufferVSprintf(&buf, " <description>%s</description>\n",
> + def->description);
> + virBufferVSprintf(&buf, " <state>%s</state>\n",
> + virDomainStateTypeToString(def->state));
> + if (def->parent) {
> + virBufferAddLit(&buf, " <parent>\n");
> + virBufferVSprintf(&buf, " <name>%s</name>\n", def->parent);
> + virBufferAddLit(&buf, " </parent>\n");
> + }
> + virBufferVSprintf(&buf, " <creationTime>%ld</creationTime>\n",
> + def->creationTime);
> + virBufferAddLit(&buf, " <domain>\n");
> + virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", domain_uuid);
> + virBufferAddLit(&buf, " </domain>\n");
> + if (internal)
> + virBufferVSprintf(&buf, " <active>%ld</active>\n", def->active);
> + virBufferAddLit(&buf, "</domainsnapshot>\n");
> +
> + if (virBufferError(&buf)) {
> + virBufferFreeAndReset(&buf);
> + virReportOOMError();
> + return NULL;
> + }
> +
> + return virBufferContentAndReset(&buf);
> +}
My only suggestion would be if we can add the name of the host where
the snapshot was taken, but that's a "nice to have" and can probably
be added later,
ACK
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list