diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1954daea52..fa23c5f973 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2044,6 +2044,25 @@ qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def, { switch ((virDomainChrType)def->type) { case VIR_DOMAIN_CHR_TYPE_TCP: + switch (def->data.tcp.protocol) { + case VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW: + case VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET: + break; + + case VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNETS: + case VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("tcp chardev protocol '%1$s' not supported"), + virDomainChrTcpProtocolTypeToString(def->data.tcp.protocol)); + return -1; + + case VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST: + default: + virReportEnumRangeError(virDomainChrTcpProtocol, def->data.tcp.protocol); + return -1; + + } + if (qemuValidateDomainChrSourceReconnectDef(&def->data.tcp.reconnect) < 0) return -1; break; diff --git a/tests/qemuxmlconfdata/serial-tcp-chardev-telnets.x86_64-latest.err b/tests/qemuxmlconfdata/serial-tcp-chardev-telnets.x86_64-latest.err new file mode 100644 index 0000000000..6447c96cd9 --- /dev/null +++ b/tests/qemuxmlconfdata/serial-tcp-chardev-telnets.x86_64-latest.err @@ -0,0 +1 @@ +unsupported configuration: tcp chardev protocol 'tls' not supported diff --git a/tests/qemuxmlconfdata/serial-tcp-chardev-telnets.xml b/tests/qemuxmlconfdata/serial-tcp-chardev-telnets.xml new file mode 100644 index 0000000000..07c36e0fa0 --- /dev/null +++ b/tests/qemuxmlconfdata/serial-tcp-chardev-telnets.xml @@ -0,0 +1,23 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 1 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + + + + diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 08dc8a10e3..61eb4cda75 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -1845,6 +1845,7 @@ mymain(void) DO_TEST_CAPS_LATEST("serial-unix-chardev"); DO_TEST_CAPS_LATEST_PARSE_ERROR("serial-unix-missing-source"); DO_TEST_CAPS_LATEST("serial-tcp-chardev"); + DO_TEST_CAPS_LATEST_PARSE_ERROR("serial-tcp-chardev-telnets"); DO_TEST_CAPS_LATEST("serial-udp-chardev"); DO_TEST_CAPS_LATEST("serial-tcp-telnet-chardev"); driver.config->chardevTLS = 1;