mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
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
This commit is contained in:
parent
386fe237b2
commit
9bc4179dd4
@ -6204,12 +6204,20 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_UDP:
|
case VIR_DOMAIN_CHR_TYPE_UDP:
|
||||||
backend_type = "socket";
|
backend_type = "udp";
|
||||||
addr = qemuMonitorJSONBuildInetSocketAddress(chr->data.udp.connectHost,
|
addr = qemuMonitorJSONBuildInetSocketAddress(chr->data.udp.connectHost,
|
||||||
chr->data.udp.connectService);
|
chr->data.udp.connectService);
|
||||||
if (!addr ||
|
if (!addr ||
|
||||||
virJSONValueObjectAppend(data, "addr", addr) < 0)
|
virJSONValueObjectAppend(data, "remote", addr) < 0)
|
||||||
goto error;
|
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;
|
addr = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -853,11 +853,23 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt)
|
|||||||
chr.data.udp.connectService = (char *) "1234";
|
chr.data.udp.connectService = (char *) "1234";
|
||||||
CHECK("udp", false,
|
CHECK("udp", false,
|
||||||
"{'id':'alias',"
|
"{'id':'alias',"
|
||||||
"'backend':{'type':'socket',"
|
"'backend':{'type':'udp',"
|
||||||
"'data':{'addr':{'type':'inet',"
|
"'data':{'remote':{'type':'inet',"
|
||||||
"'data':{'host':'example.com',"
|
"'data':{'host':'example.com',"
|
||||||
"'port':'1234'}}}}}");
|
"'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));
|
memset(&chr, 0, sizeof(chr));
|
||||||
chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
|
chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
|
||||||
chr.data.nix.path = (char *) "/path/to/socket";
|
chr.data.nix.path = (char *) "/path/to/socket";
|
||||||
|
Loading…
Reference in New Issue
Block a user