This patch changes following output: ... <graphics type='vnc' port='-1' autoport='yes'> <listen type='none'/> </graphics> ... into this output: ... <graphics type='vnc'> <listen type='none'/> </graphics> ... Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- src/conf/domain_conf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fe9b7c7273..88bcd6c052 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23297,7 +23297,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, return -1; } - if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) { + switch (glisten->type) { + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: /* To not break migration we shouldn't print the 'socket' attribute * if it's auto-generated or if it's based on config option from * qemu.conf. If the socket is provided by user we need to print it @@ -23307,7 +23308,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf, (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))) { virBufferEscapeString(buf, " socket='%s'", glisten->socket); } - } else { + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: if (def->data.vnc.port && (!def->data.vnc.autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))) virBufferAsprintf(buf, " port='%d'", @@ -23325,6 +23329,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " websocket='%d'", def->data.vnc.websocket); virDomainGraphicsListenDefFormatAddr(buf, glisten, flags); + break; + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; } if (def->data.vnc.keymap) -- 2.12.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list