mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 05:25:18 +00:00
qemuDomainAttachNetDevice: Clean up unneeded 'slirp' helper variables
We don't need 'slirpfdName' and 'slirpfd'. The 'slirp' local can be removed too as qemuSlirpStart is safe to be called if there's nothing to do. 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:
parent
c8633d35ca
commit
08b0ac6683
@ -1183,8 +1183,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
||||
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_NET, { .net = net } };
|
||||
qemuDomainNetworkPrivate *netpriv = QEMU_DOMAIN_NETWORK_PRIVATE(net);
|
||||
virErrorPtr originalError = NULL;
|
||||
g_autofree char *slirpfdName = NULL;
|
||||
int slirpfd = -1;
|
||||
g_autoptr(virJSONValue) nicprops = NULL;
|
||||
g_autoptr(virJSONValue) netprops = NULL;
|
||||
int ret = -1;
|
||||
@ -1305,14 +1303,10 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
||||
case VIR_DOMAIN_NET_TYPE_USER:
|
||||
if (!priv->disableSlirp &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DBUS_VMSTATE)) {
|
||||
qemuSlirp *slirp = NULL;
|
||||
|
||||
if (qemuInterfacePrepareSlirp(driver, net) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(slirp = QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp))
|
||||
break;
|
||||
|
||||
if (qemuSlirpStart(vm, net, NULL) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Failed to start slirp"));
|
||||
@ -1408,7 +1402,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
||||
}
|
||||
|
||||
if (qemuMonitorAddNetdev(priv->mon, &netprops,
|
||||
slirpfd, slirpfdName) < 0) {
|
||||
-1, NULL) < 0) {
|
||||
qemuDomainObjExitMonitor(vm);
|
||||
virDomainAuditNet(vm, NULL, net, "attach", false);
|
||||
goto try_remove;
|
||||
@ -1511,7 +1505,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
||||
}
|
||||
|
||||
virDomainCCWAddressSetFree(ccwaddrs);
|
||||
VIR_FORCE_CLOSE(slirpfd);
|
||||
|
||||
return ret;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user