Fix autoport when domain is inactive

This commit is contained in:
Daniel P. Berrange 2008-07-31 14:39:30 +00:00
parent 6f17fb2851
commit 42e559a324
2 changed files with 10 additions and 2 deletions

View File

@ -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> 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 * src/domain_conf.c: patch from Charles Duffy to make sure we print

View File

@ -2416,6 +2416,7 @@ virDomainInputDefFormat(virConnectPtr conn,
static int static int
virDomainGraphicsDefFormat(virConnectPtr conn, virDomainGraphicsDefFormat(virConnectPtr conn,
virBufferPtr buf, virBufferPtr buf,
virDomainDefPtr vm,
virDomainGraphicsDefPtr def, virDomainGraphicsDefPtr def,
int flags) int flags)
{ {
@ -2431,7 +2432,8 @@ virDomainGraphicsDefFormat(virConnectPtr conn,
switch (def->type) { switch (def->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_VNC: 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'", virBufferVSprintf(buf, " port='%d'",
def->data.vnc.port); def->data.vnc.port);
else if (def->data.vnc.autoport) else if (def->data.vnc.autoport)
@ -2674,7 +2676,7 @@ char *virDomainDefFormat(virConnectPtr conn,
if (virDomainInputDefFormat(conn, &buf, &autoInput) < 0) if (virDomainInputDefFormat(conn, &buf, &autoInput) < 0)
goto cleanup; goto cleanup;
if (virDomainGraphicsDefFormat(conn, &buf, def->graphics, flags) < 0) if (virDomainGraphicsDefFormat(conn, &buf, def, def->graphics, flags) < 0)
goto cleanup; goto cleanup;
} }