From 6287e7ea4a47e6035df91548bbc4983628898d23 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Wed, 26 Apr 2017 12:47:49 +0200 Subject: [PATCH] conf: format only relevant attributes for graphics based on listen type This patch changes following output: ... ... into this output: ... ... Signed-off-by: Pavel Hrdina (cherry picked from commit 2b7d516434190ae4da44aee3b9ae98f776d912a0) --- 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 1b0a55b27f..485580ab37 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23203,7 +23203,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 @@ -23213,7 +23214,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'", @@ -23231,6 +23235,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)