Per subject; if autoport is in use for a host, the current virDomainGraphicsDefFormat code always emits "port=-1", even if a port is assigned to the host; this leaves no way for a client to find the VNC port assigned to the host in question.
diff --git a/src/domain_conf.c b/src/domain_conf.c
index d629093..ece471e 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -2431,11 +2431,11 @@ virDomainGraphicsDefFormat(virConnectPtr conn,
 
     switch (def->type) {
     case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
-        if (def->data.vnc.autoport)
-            virBufferAddLit(buf, " port='-1'");
-        else if (def->data.vnc.port)
+        if (def->data.vnc.port)
             virBufferVSprintf(buf, " port='%d'",
                               def->data.vnc.port);
+        else if (def->data.vnc.autoport)
+            virBufferAddLit(buf, " port='-1'");
 
         virBufferVSprintf(buf, " autoport='%s'",
                           def->data.vnc.autoport ? "yes" : "no");

Reply via email to