mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
qemu: Don't force port=0 for SPICE
If domain uses only TLS port we don't want to add 'port=0' explicitly to command line.
This commit is contained in:
parent
30f1bccf33
commit
9f87247235
@ -6023,6 +6023,8 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
char *netAddr = NULL;
|
char *netAddr = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
int defaultMode = def->graphics[0]->data.spice.defaultMode;
|
int defaultMode = def->graphics[0]->data.spice.defaultMode;
|
||||||
|
int port = def->graphics[0]->data.spice.port;
|
||||||
|
int tlsPort = def->graphics[0]->data.spice.tlsPort;
|
||||||
|
|
||||||
if (!qemuCapsGet(caps, QEMU_CAPS_SPICE)) {
|
if (!qemuCapsGet(caps, QEMU_CAPS_SPICE)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
@ -6030,17 +6032,19 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(&opt, "port=%u", def->graphics[0]->data.spice.port);
|
if (port > 0 || tlsPort <= 0)
|
||||||
|
virBufferAsprintf(&opt, "port=%u", port);
|
||||||
|
|
||||||
if (def->graphics[0]->data.spice.tlsPort > 0) {
|
if (tlsPort > 0) {
|
||||||
if (!driver->spiceTLS) {
|
if (!driver->spiceTLS) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("spice TLS port set in XML configuration,"
|
_("spice TLS port set in XML configuration,"
|
||||||
" but TLS is disabled in qemu.conf"));
|
" but TLS is disabled in qemu.conf"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
virBufferAsprintf(&opt, ",tls-port=%u",
|
if (port > 0)
|
||||||
def->graphics[0]->data.spice.tlsPort);
|
virBufferAddChar(&opt, ',');
|
||||||
|
virBufferAsprintf(&opt, "tls-port=%u", tlsPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (virDomainGraphicsListenGetType(def->graphics[0], 0)) {
|
switch (virDomainGraphicsListenGetType(def->graphics[0], 0)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user