1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-29 15:21:50 +03:00

qemuMonitorAddNetdev: Remove 'vhostfd' machinery

All callers now pass NULL/0 as arguments for vhostfd passing so we can
remove all the associated code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-05-10 14:41:12 +02:00
parent 4b3e730c77
commit e22284d7bb
3 changed files with 3 additions and 15 deletions

View File

@ -1461,7 +1461,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
if (qemuMonitorAddNetdev(priv->mon, &netprops, if (qemuMonitorAddNetdev(priv->mon, &netprops,
tapfd, tapfdName, tapfdSize, tapfd, tapfdName, tapfdSize,
NULL, NULL, 0,
slirpfd, slirpfdName) < 0) { slirpfd, slirpfdName) < 0) {
qemuDomainObjExitMonitor(vm); qemuDomainObjExitMonitor(vm);
virDomainAuditNet(vm, NULL, net, "attach", false); virDomainAuditNet(vm, NULL, net, "attach", false);
@ -2242,7 +2241,7 @@ qemuDomainAttachChrDevice(virQEMUDriver *driver,
if (netdevprops) { if (netdevprops) {
if (qemuMonitorAddNetdev(priv->mon, &netdevprops, if (qemuMonitorAddNetdev(priv->mon, &netdevprops,
NULL, NULL, 0, NULL, NULL, 0, -1, NULL) < 0) NULL, NULL, 0, -1, NULL) < 0)
goto exit_monitor; goto exit_monitor;
} }

View File

@ -2631,17 +2631,15 @@ int
qemuMonitorAddNetdev(qemuMonitor *mon, qemuMonitorAddNetdev(qemuMonitor *mon,
virJSONValue **props, virJSONValue **props,
int *tapfd, char **tapfdName, int tapfdSize, int *tapfd, char **tapfdName, int tapfdSize,
int *vhostfd, char **vhostfdName, int vhostfdSize,
int slirpfd, char *slirpfdName) int slirpfd, char *slirpfdName)
{ {
int ret = -1; int ret = -1;
size_t i = 0, j = 0; size_t i = 0;
VIR_DEBUG("props=%p tapfd=%p tapfdName=%p tapfdSize=%d" VIR_DEBUG("props=%p tapfd=%p tapfdName=%p tapfdSize=%d"
"vhostfd=%p vhostfdName=%p vhostfdSize=%d"
"slirpfd=%d slirpfdName=%s", "slirpfd=%d slirpfdName=%s",
props, tapfd, tapfdName, tapfdSize, props, tapfd, tapfdName, tapfdSize,
vhostfd, vhostfdName, vhostfdSize, slirpfd, slirpfdName); slirpfd, slirpfdName);
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);
@ -2649,10 +2647,6 @@ qemuMonitorAddNetdev(qemuMonitor *mon,
if (qemuMonitorSendFileHandle(mon, tapfdName[i], tapfd[i]) < 0) if (qemuMonitorSendFileHandle(mon, tapfdName[i], tapfd[i]) < 0)
goto cleanup; goto cleanup;
} }
for (j = 0; j < vhostfdSize; j++) {
if (qemuMonitorSendFileHandle(mon, vhostfdName[j], vhostfd[j]) < 0)
goto cleanup;
}
if (slirpfd > 0 && if (slirpfd > 0 &&
qemuMonitorSendFileHandle(mon, slirpfdName, slirpfd) < 0) qemuMonitorSendFileHandle(mon, slirpfdName, slirpfd) < 0)
@ -2666,10 +2660,6 @@ qemuMonitorAddNetdev(qemuMonitor *mon,
if (qemuMonitorCloseFileHandle(mon, tapfdName[i]) < 0) if (qemuMonitorCloseFileHandle(mon, tapfdName[i]) < 0)
VIR_WARN("failed to close device handle '%s'", tapfdName[i]); VIR_WARN("failed to close device handle '%s'", tapfdName[i]);
} }
while (j--) {
if (qemuMonitorCloseFileHandle(mon, vhostfdName[j]) < 0)
VIR_WARN("failed to close device handle '%s'", vhostfdName[j]);
}
if (qemuMonitorCloseFileHandle(mon, slirpfdName) < 0) if (qemuMonitorCloseFileHandle(mon, slirpfdName) < 0)
VIR_WARN("failed to close device handle '%s'", slirpfdName); VIR_WARN("failed to close device handle '%s'", slirpfdName);
} }

View File

@ -984,7 +984,6 @@ int qemuMonitorCloseFileHandle(qemuMonitor *mon,
int qemuMonitorAddNetdev(qemuMonitor *mon, int qemuMonitorAddNetdev(qemuMonitor *mon,
virJSONValue **props, virJSONValue **props,
int *tapfd, char **tapfdName, int tapfdSize, int *tapfd, char **tapfdName, int tapfdSize,
int *vhostfd, char **vhostfdName, int vhostfdSize,
int slirpfd, char *slirpfdName); int slirpfd, char *slirpfdName);
int qemuMonitorRemoveNetdev(qemuMonitor *mon, int qemuMonitorRemoveNetdev(qemuMonitor *mon,