提交 9bc4179d 编写于 作者: P Peter Krempa

qemu: monitor: Properly configure backend for UDP chardevs

Since introduction of chardev hotplug the code was wrong for the UDP
case and basically created a TCP socket instead. Use proper objects and
type for UDP.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1377602
上级 386fe237
......@@ -6204,12 +6204,20 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
break;
case VIR_DOMAIN_CHR_TYPE_UDP:
backend_type = "socket";
backend_type = "udp";
addr = qemuMonitorJSONBuildInetSocketAddress(chr->data.udp.connectHost,
chr->data.udp.connectService);
if (!addr ||
virJSONValueObjectAppend(data, "addr", addr) < 0)
virJSONValueObjectAppend(data, "remote", addr) < 0)
goto error;
if (chr->data.udp.bindHost) {
addr = qemuMonitorJSONBuildInetSocketAddress(chr->data.udp.bindHost,
chr->data.udp.bindService);
if (!addr ||
virJSONValueObjectAppend(data, "local", addr) < 0)
goto error;
}
addr = NULL;
break;
......
......@@ -853,10 +853,22 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt)
chr.data.udp.connectService = (char *) "1234";
CHECK("udp", false,
"{'id':'alias',"
"'backend':{'type':'socket',"
"'data':{'addr':{'type':'inet',"
"'data':{'host':'example.com',"
"'port':'1234'}}}}}");
"'backend':{'type':'udp',"
"'data':{'remote':{'type':'inet',"
"'data':{'host':'example.com',"
"'port':'1234'}}}}}");
chr.data.udp.bindHost = (char *) "localhost";
chr.data.udp.bindService = (char *) "4321";
CHECK("udp", false,
"{'id':'alias',"
"'backend':{'type':'udp',"
"'data':{'remote':{'type':'inet',"
"'data':{'host':'example.com',"
"'port':'1234'}},"
"'local':{'type':'inet',"
"'data':{'host':'localhost',"
"'port':'4321'}}}}}");
memset(&chr, 0, sizeof(chr));
chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册