提交 6287e7ea 编写于 作者: P Pavel Hrdina 提交者: Cole Robinson

conf: format only relevant attributes for graphics based on listen type

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: NPavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 2b7d5164)
上级 a050815a
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册