mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
d111f52c35
commit
2b7d516434
@ -23310,7 +23310,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
|||||||
return -1;
|
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
|
/* 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
|
* 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
|
* qemu.conf. If the socket is provided by user we need to print it
|
||||||
@ -23320,7 +23321,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
|||||||
(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))) {
|
(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE))) {
|
||||||
virBufferEscapeString(buf, " socket='%s'", glisten->socket);
|
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 &&
|
if (def->data.vnc.port &&
|
||||||
(!def->data.vnc.autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
|
(!def->data.vnc.autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
|
||||||
virBufferAsprintf(buf, " port='%d'",
|
virBufferAsprintf(buf, " port='%d'",
|
||||||
@ -23338,6 +23342,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
|||||||
virBufferAsprintf(buf, " websocket='%d'", def->data.vnc.websocket);
|
virBufferAsprintf(buf, " websocket='%d'", def->data.vnc.websocket);
|
||||||
|
|
||||||
virDomainGraphicsListenDefFormatAddr(buf, glisten, flags);
|
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)
|
if (def->data.vnc.keymap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user