[libvirt] [Charles_Duffy at messageone.com: [PATCH] autoport overrides actual VNC port number in dump-xml]

Daniel P. Berrange berrange at redhat.com
Wed Jul 30 09:43:35 UTC 2008


On Wed, Jul 30, 2008 at 05:33:22AM -0400, Daniel Veillard wrote:
> On Wed, Jul 30, 2008 at 10:17:59AM +0100, Daniel P. Berrange wrote:
> > Forwarding message that was sent to wrong list...
> 
>   Hum, that sounds right, the logic got twisted, the presence of
> a defined port should otherride the autoport settings, right ?

Yes, this logic was coded badly by me. What I was trying to address
here was that the declared port should be reset to -1 for inactive
domains, when autoport is yes. I ended up always setting it to -1.

So instead of this:

        if (def->data.vnc.autoport)
            virBufferAddLit(buf, " port='-1'");
        else if (def->data.vnc.port)
            virBufferVSprintf(buf, " port='%d'",
                              def->data.vnc.port);

What I think we need is this:

        if (def->data.vnc.port && 
            (!def->data.vnc.autoport || def->id != -1)) 
            virBufferVSprintf(buf, " port='%d'",
                              def->data.vnc.port);
        else if (def->data.vnc.autiport)
            virBufferAddLit(buf, " port='-1'");

So the explicit port is output in XML if autoport is not set, or
if the domain is running.

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




More information about the libvir-list mailing list