On Mon, Dec 29, 2008 at 03:44:54PM +0100, Guido Günther wrote:
Hi,
current domstatus code saves the domain as number, attached patch safes
it as string which looks a bit nicer.
[...]
@@ -1414,7 +1416,9 @@ qemudDomainStatusFormat(virConnectPtr conn,
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, "<domstatus state='%s'
pid='%d'>\n",
+ virDomainStateTypeToString(vm->state),
+ vm->pid);
virBufferEscapeString(&buf, " <monitor path='%s'/>\n",
vm->monitorpath);
if (!(config_xml = virDomainDefFormat(conn,
Hum, I have 2 objections to this patch:
- seems we keep a string value internally in the structure, I don't
see the benefit, or maybe I misunderstood.
- second more important is that we change the XML interface, that we
can't do, maybe we can extend it to provide a stateinfo="%s"
along the state='%d', but we can't just break code which may rely
on the existing format.
maybe I missed something though,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/