Re: [libvirt] [PATCH 3/5] add XML parsing for vm status file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 12, 2008 at 07:26:51PM +0100, Guido Günther wrote:
> Functions to read and write vm status in $(statedir)/qemu/<domain>.xml.
> Keeps the necessary to reconnect to a running domain state within
> <domstate>...</domstate>. I kept most of the code in qemu_config.c for
> now. We can easily move it should another hypervisor need to do
> something similar.
[...]
> +static char*
> +qemudDomainStatusFormat(virConnectPtr conn,
> +                        virDomainObjPtr vm)
> +{
> +    char *config_xml = NULL, *xml = NULL;
> +    virBuffer buf = VIR_BUFFER_INITIALIZER;
> +
> +    virBufferVSprintf(&buf, "<domstatus state='%d' pid='%d'>\n", vm->state, vm->pid);
> +    virBufferVSprintf(&buf, "  <monitor path='%s'/>\n", vm->monitorpath);

  I would use virBufferEscapeString here, even if by default the path
should not contain characters needing escaping, I think it's safer.

> +    if (!(config_xml = virDomainDefFormat(conn,
> +                                          vm->def,
> +                                          VIR_DOMAIN_XML_SECURE)))
> +        goto cleanup;
> +
> +    virBufferVSprintf(&buf, "%s", config_xml);

  Same thing here.

> +    virBufferVSprintf(&buf, "</domstatus>\n");

  Overall the patch looks fine to me, +1

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]