On Wed, Jul 30, 2008 at 09:26:53AM +0200, Chris Lalancette wrote:
Hey,
I've run into another regression when using a KVM guest with libvirt tip.
If I have a guest with some XML:
<graphics type='vnc' port='-1' listen='127.0.0.1'/>
Then when I "virsh define" that guest, it ends up looking like:
<graphics type='vnc' port='-1' autoport='yes'
listen='127.0.0.1'/>
So far, so good. Now, when I actually "virsh start" the guest, it ends up
like:
<graphics type='vnc' port='-1' autoport='yes'
listen='127.0.0.1'/>
That is, there is no change to the XML when the domain is running. What is
supposed to happen is that the "port" field should be filled in with the port
that libvirt ended up choosing for this guest. This is important for tools like
virt-viewer, which parse this part of the XML to find out where to connect to.
Looking at the code, I believe the problem is in
src/domain_conf.c:virDomainGraphicsDefFormat(). It looks like:
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
if (def->data.vnc.autoport)
virBufferAddLit(buf, " port='-1'");
else if (def->data.vnc.port)
virBufferVSprintf(buf, " port='%d'",
def->data.vnc.port);
The problem is that we are missing some sort of "isActive" check in there, so
that it fills in the actual port it is using if the domain is running.
Unfortunately, from a quick perusal, I couldn't easily figure out how to do
this; does someone have a suggestion on how to fix this?
Can you try the patch posted by Charles Duffy a short while ago, with
subject "autoport overrides actual VNC port number in dump-xml". I
think it should solve your immediate problem.
Daniel
--
|: 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 :|