Re: [libvirt] [PATCH] save state as string

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

 



On Tue, Jan 06, 2009 at 03:27:52PM +0100, Daniel Veillard wrote:
> 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.
Currently we have state='1' for running, with this patch this reads
state='running' which is better readable.

>     - 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.
The file we write is /var/run/libvirt/qemu/*.xml where we keep the
internal state of a running vm. We can change this at at any time.
Cheers,
 -- Guido

--
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]