As of QEMU 0.9.0 the -vnc option accepts a ':' to separate port
from listen address, so the QEMU driver can assume that support
for listen addresses is always available.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 4 -
src/qemu/qemu_capabilities.h | 2 +-
src/qemu/qemu_command.c | 143 ++++++++++-----------
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 -
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 -
tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 1 -
tests/qemucaps2xmldata/all_1.6.0-1.caps | 1 -
tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps | 1 -
tests/qemuhelptest.c | 8 --
tests/qemuxml2argvtest.c | 1 -
tests/qemuxml2xmltest.c | 1 -
tests/qemuxmlnstest.c | 1 -
16 files changed, 69 insertions(+), 100 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index bbb9e9c..55c310c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1229,9 +1229,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
strstr(help, "sockets="))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY);
- if (version >= 9000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_COLON);
-
if (is_kvm && (version >= 10000 || kvm_version >= 74))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR);
@@ -3219,7 +3216,6 @@ static qemuMonitorCallbacks callbacks = {
static void
virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
{
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_COLON);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_REBOOT);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NAME);
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 18bff75..af30759 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -47,7 +47,7 @@
typedef enum {
/* 0 */
X_QEMU_CAPS_KQEMU, /* Whether KQEMU is compiled in */
- QEMU_CAPS_VNC_COLON, /* VNC takes or address + display */
+ X_QEMU_CAPS_VNC_COLON, /* VNC takes or address + display */
QEMU_CAPS_NO_REBOOT, /* Is the -no-reboot flag available */
QEMU_CAPS_DRIVE, /* Is the new -drive arg available */
QEMU_CAPS_DRIVE_BOOT, /* Does -drive support boot=on */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 26dc354..25c7b78 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8210,97 +8210,90 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
goto error;
}
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
- switch (virDomainGraphicsListenGetType(graphics, 0)) {
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
- listenAddr = virDomainGraphicsListenGetAddress(graphics, 0);
- break;
-
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
- listenNetwork = virDomainGraphicsListenGetNetwork(graphics, 0);
- if (!listenNetwork)
- break;
- ret = networkGetNetworkAddress(listenNetwork, &netAddr);
- if (ret <= -2) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("network-based listen not
possible, "
- "network driver not present"));
- goto error;
- }
- if (ret < 0)
- goto error;
+ switch (virDomainGraphicsListenGetType(graphics, 0)) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ listenAddr = virDomainGraphicsListenGetAddress(graphics, 0);
+ break;
- listenAddr = netAddr;
- /* store the address we found in the <graphics> element so it
- * will show up in status. */
- if (virDomainGraphicsListenSetAddress(graphics, 0,
- listenAddr, -1, false) < 0)
- goto error;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ listenNetwork = virDomainGraphicsListenGetNetwork(graphics, 0);
+ if (!listenNetwork)
break;
+ ret = networkGetNetworkAddress(listenNetwork, &netAddr);
+ if (ret <= -2) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("network-based listen not possible,
"
+ "network driver not present"));
+ goto error;
}
+ if (ret < 0)
+ goto error;
- if (!listenAddr)
- listenAddr = cfg->vncListen;
+ listenAddr = netAddr;
+ /* store the address we found in the <graphics> element so it
+ * will show up in status. */
+ if (virDomainGraphicsListenSetAddress(graphics, 0,
+ listenAddr, -1, false) < 0)
+ goto error;
+ break;
+ }
- escapeAddr = strchr(listenAddr, ':') != NULL;
- if (escapeAddr)
- virBufferAsprintf(&opt, "[%s]", listenAddr);
- else
- virBufferAdd(&opt, listenAddr, -1);
- virBufferAsprintf(&opt, ":%d",
- graphics->data.vnc.port - 5900);
+ if (!listenAddr)
+ listenAddr = cfg->vncListen;
- VIR_FREE(netAddr);
- } else {
- virBufferAsprintf(&opt, "%d",
- graphics->data.vnc.port - 5900);
- }
+ escapeAddr = strchr(listenAddr, ':') != NULL;
+ if (escapeAddr)
+ virBufferAsprintf(&opt, "[%s]", listenAddr);
+ else
+ virBufferAdd(&opt, listenAddr, -1);
+ virBufferAsprintf(&opt, ":%d",
+ graphics->data.vnc.port - 5900);
+
+ VIR_FREE(netAddr);
}
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
- if (!graphics->data.vnc.socket &&
- graphics->data.vnc.websocket) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_WEBSOCKET)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("VNC WebSockets are not supported "
- "with this QEMU binary"));
- goto error;
- }
- virBufferAsprintf(&opt, ",websocket=%d",
graphics->data.vnc.websocket);
- }
+ if (!graphics->data.vnc.socket &&
+ graphics->data.vnc.websocket) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_WEBSOCKET)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("VNC WebSockets are not supported "
+ "with this QEMU binary"));
+ goto error;
+ }
+ virBufferAsprintf(&opt, ",websocket=%d",
graphics->data.vnc.websocket);
+ }
- if (graphics->data.vnc.sharePolicy) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("vnc display sharing policy is not "
- "supported with this QEMU"));
- goto error;
- }
+ if (graphics->data.vnc.sharePolicy) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("vnc display sharing policy is not "
+ "supported with this QEMU"));
+ goto error;
+ }
- virBufferAsprintf(&opt, ",share=%s",
- virDomainGraphicsVNCSharePolicyTypeToString(
+ virBufferAsprintf(&opt, ",share=%s",
+ virDomainGraphicsVNCSharePolicyTypeToString(
graphics->data.vnc.sharePolicy));
- }
+ }
- if (graphics->data.vnc.auth.passwd || cfg->vncPassword)
- virBufferAddLit(&opt, ",password");
+ if (graphics->data.vnc.auth.passwd || cfg->vncPassword)
+ virBufferAddLit(&opt, ",password");
- if (cfg->vncTLS) {
- virBufferAddLit(&opt, ",tls");
- if (cfg->vncTLSx509verify)
- virBufferAsprintf(&opt, ",x509verify=%s",
cfg->vncTLSx509certdir);
- else
- virBufferAsprintf(&opt, ",x509=%s",
cfg->vncTLSx509certdir);
- }
+ if (cfg->vncTLS) {
+ virBufferAddLit(&opt, ",tls");
+ if (cfg->vncTLSx509verify)
+ virBufferAsprintf(&opt, ",x509verify=%s",
cfg->vncTLSx509certdir);
+ else
+ virBufferAsprintf(&opt, ",x509=%s",
cfg->vncTLSx509certdir);
+ }
- if (cfg->vncSASL) {
- virBufferAddLit(&opt, ",sasl");
+ if (cfg->vncSASL) {
+ virBufferAddLit(&opt, ",sasl");
- if (cfg->vncSASLdir)
- virCommandAddEnvPair(cmd, "SASL_CONF_PATH",
cfg->vncSASLdir);
+ if (cfg->vncSASLdir)
+ virCommandAddEnvPair(cmd, "SASL_CONF_PATH", cfg->vncSASLdir);
- /* TODO: Support ACLs later */
- }
+ /* TODO: Support ACLs later */
}
virCommandAddArg(cmd, "-vnc");
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
index 5f179de..743951b 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
index dad097a..a3e9b4a 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
index 1f2682e..e1c0354 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index 95f364f..1ba18d6 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index 6533a6e..738cbae 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index b2e775b..1c01523 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
index 88fe13a..3bf0e6c 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucaps2xmldata/all_1.6.0-1.caps
b/tests/qemucaps2xmldata/all_1.6.0-1.caps
index 2d50cf9..7a16aa7 100644
--- a/tests/qemucaps2xmldata/all_1.6.0-1.caps
+++ b/tests/qemucaps2xmldata/all_1.6.0-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
index 5092e41..74399fc 100644
--- a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
+++ b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
@@ -1,5 +1,4 @@
<qemuCaps>
- <flag name='vnc-colon'/>
<flag name='no-reboot'/>
<flag name='drive'/>
<flag name='name'/>
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 9f4bfea..91be08d 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -152,7 +152,6 @@ mymain(void)
DO_TEST_FULL(name, version, is_kvm, kvm_version, VIR_ERR_OK, __VA_ARGS__)
DO_TEST("qemu-0.12.1", 12001, 0, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_NAME,
@@ -188,7 +187,6 @@ mymain(void)
QEMU_CAPS_CPU_HOST,
QEMU_CAPS_VNC);
DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_DRIVE_BOOT,
@@ -251,7 +249,6 @@ mymain(void)
QEMU_CAPS_DEVICE_E1000,
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_DRIVE_BOOT,
@@ -294,7 +291,6 @@ mymain(void)
QEMU_CAPS_CPU_HOST,
QEMU_CAPS_VNC);
DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_DRIVE_BOOT,
@@ -369,7 +365,6 @@ mymain(void)
QEMU_CAPS_DEVICE_E1000,
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_NAME,
@@ -439,7 +434,6 @@ mymain(void)
QEMU_CAPS_DEVICE_E1000,
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_NAME,
@@ -517,7 +511,6 @@ mymain(void)
QEMU_CAPS_DEVICE_E1000,
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-1.0", 1000000, 0, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_NAME,
@@ -610,7 +603,6 @@ mymain(void)
QEMU_CAPS_DEVICE_E1000,
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-1.1.0", 1001000, 0, 0,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DRIVE,
QEMU_CAPS_NAME,
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 53580e3..9c92eff 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -292,7 +292,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
monitor_chr.data.nix.listen = true;
virQEMUCapsSetList(extraFlags,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_NO_ACPI,
QEMU_CAPS_LAST);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 5a9c67d..2583e67 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -114,7 +114,6 @@ static const char testStatusXMLPrefix[] =
" <vcpu pid='3803519'/>\n"
" </vcpus>\n"
" <qemuCaps>\n"
-" <flag name='vnc-colon'/>\n"
" <flag name='no-reboot'/>\n"
" <flag name='drive'/>\n"
" <flag name='name'/>\n"
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 65bf1d3..3e1b4aa 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -86,7 +86,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto fail;
virQEMUCapsSetList(extraFlags,
- QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_NO_ACPI,
QEMU_CAPS_LAST);
--
2.5.0