[libvirt] Small regression with domain refactoring

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

 



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?

Thanks,
Chris Lalancette

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