]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix autoport when domain is inactive
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 31 Jul 2008 14:39:30 +0000 (14:39 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 31 Jul 2008 14:39:30 +0000 (14:39 +0000)
ChangeLog
src/domain_conf.c

index 304c53a7f505d374bb000d257f5d4b29fa72f674..fa2dc4c5ab0026e2f174d913b46c4ea029f908d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Jul 31 15:37:00 BST 2008 Daniel P. Berrange <berrange@redhat.com>
+
+       * src/domain_conf.c: fix previous patch to ensure port number
+       is kept as '-1' when autoport is set, and the domain is not
+       running.
+
 Thu Jul 31 14:27:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
 
        * src/domain_conf.c: patch from Charles Duffy to make sure we print
index ece471e75c335de2b400e868329a5e156ec5d4dc..30a40eb8190498c09d4b963ac10428dd86cfda0d 100644 (file)
@@ -2416,6 +2416,7 @@ virDomainInputDefFormat(virConnectPtr conn,
 static int
 virDomainGraphicsDefFormat(virConnectPtr conn,
                            virBufferPtr buf,
+                           virDomainDefPtr vm,
                            virDomainGraphicsDefPtr def,
                            int flags)
 {
@@ -2431,7 +2432,8 @@ virDomainGraphicsDefFormat(virConnectPtr conn,
 
     switch (def->type) {
     case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
-        if (def->data.vnc.port)
+        if (def->data.vnc.port &&
+            (!def->data.vnc.autoport || vm->id != -1))
             virBufferVSprintf(buf, " port='%d'",
                               def->data.vnc.port);
         else if (def->data.vnc.autoport)
@@ -2674,7 +2676,7 @@ char *virDomainDefFormat(virConnectPtr conn,
         if (virDomainInputDefFormat(conn, &buf, &autoInput) < 0)
             goto cleanup;
 
-        if (virDomainGraphicsDefFormat(conn, &buf, def->graphics, flags) < 0)
+        if (virDomainGraphicsDefFormat(conn, &buf, def, def->graphics, flags) < 0)
             goto cleanup;
     }