From: Daniel P. Berrange Date: Thu, 31 Jul 2008 14:39:30 +0000 (+0000) Subject: Fix autoport when domain is inactive X-Git-Tag: LIBVIRT_0_4_6~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42e559a324d224ce60b3165a3a947995b00d6355;p=thirdparty%2Flibvirt.git Fix autoport when domain is inactive --- diff --git a/ChangeLog b/ChangeLog index 304c53a7f5..fa2dc4c5ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jul 31 15:37:00 BST 2008 Daniel P. Berrange + + * 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 * src/domain_conf.c: patch from Charles Duffy to make sure we print diff --git a/src/domain_conf.c b/src/domain_conf.c index ece471e75c..30a40eb819 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -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; }