[libvirt] PATCH: Generic internal API for domain XML parser/formatter

Daniel P. Berrange berrange at redhat.com
Wed Jun 25 09:54:10 UTC 2008

On Wed, Jun 25, 2008 at 10:05:30AM +0200, Gerd Hoffmann wrote:
> Daniel P. Berrange wrote:
> > In the <graphics> element for VNC we have a 'port' attribute. For a running
> > VM this contains the actual port number. For an inactive VM it contains
> > the pre-allocated fixed port number, or -1 to indicate that a automatically
> > allocated port should be used.
> > 
> > There is an obvious flaw here - if the VM is running it is impossible to
> > tell if its port was fixed or automatically allocated.
> Oh, there are some other places where something simliar happens.  For
> example the network interface target device name, which also can be
> either auto-allocated or hardcoded.

We deal with that slightly differently - if we see a target interface
passed in called  'vnetXXXX' or 'vifX.Y' then we ignore it & treat it
as a autogenerated interface.

> IMHO it is a fundamental design flaw that dumpxml gives different
> results depending on whenever the domain is running or not.  Hard to fix
> by now though :-(

Actually there is another way to access the info - pass the flag
VIR_DOMAIN_XML_INACTIVE to the DumpXML method to explicitly request
the inactive XML.

> If you change the domain config using dumpxml/edit/define while the
> domain is running you change the current auto-assigned values into
> hardcoded config items as (unwanted) side effect.  You can easily end up
> with two domains being configured with tap device vnet0 and/or vnc port
> 5900 without noticing.  And then you wounder why trying to start both
> domains at the same time doesn't fly ...

With this patch we now correctly handle the the VNC and vnetXX case.
I also fixed the PV text console PTY issue too when we added the full
serial/parallel port support. I'm not aware of any other problems like
this besides these.

|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list