On Wed, Jul 30, 2008 at 10:43:35AM +0100, Daniel P. Berrange wrote: > 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. Okay +1, push the patch :-) Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@xxxxxxxxxx | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list