No need to ask the callers to call this extra function.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_extdevice.c | 9 ---------
src/qemu/qemu_hotplug.c | 3 +--
src/qemu/qemu_slirp.c | 5 ++++-
src/qemu/qemu_slirp.h | 4 ----
4 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index 1e54d4ef2c..9ef2a984f5 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -130,7 +130,6 @@ qemuExtDevicesPrepareHost(virQEMUDriver *driver,
virDomainObj *vm)
{
virDomainDef *def = vm->def;
- size_t i;
if (qemuExtDevicesInitPaths(driver, def) < 0)
return -1;
@@ -139,14 +138,6 @@ qemuExtDevicesPrepareHost(virQEMUDriver *driver,
qemuExtTPMPrepareHost(driver, def) < 0)
return -1;
- for (i = 0; i < def->nnets; i++) {
- virDomainNetDef *net = def->nets[i];
- qemuSlirp *slirp = QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp;
-
- if (slirp && qemuSlirpOpen(slirp, driver, def) < 0)
- return -1;
- }
-
return 0;
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 9eeba0210f..8f5e971570 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1313,8 +1313,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
if (!(slirp = QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp))
break;
- if (qemuSlirpOpen(slirp, driver, vm->def) < 0 ||
- qemuSlirpStart(vm, net, NULL) < 0) {
+ if (qemuSlirpStart(vm, net, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to start slirp"));
goto cleanup;
diff --git a/src/qemu/qemu_slirp.c b/src/qemu/qemu_slirp.c
index e1f06573e3..136e4b29d2 100644
--- a/src/qemu/qemu_slirp.c
+++ b/src/qemu/qemu_slirp.c
@@ -156,7 +156,7 @@ qemuSlirpCreatePidFilename(virQEMUDriverConfig *cfg,
}
-int
+static int
qemuSlirpOpen(qemuSlirp *slirp,
virQEMUDriver *driver,
virDomainDef *def)
@@ -272,6 +272,9 @@ qemuSlirpStart(virDomainObj *vm,
_("The slirp-helper doesn't support migration"));
}
+ if (qemuSlirpOpen(slirp, driver, vm->def) < 0)
+ return -1;
+
if (!(pidfile = qemuSlirpCreatePidFilename(cfg, vm->def, net->info.alias)))
return -1;
diff --git a/src/qemu/qemu_slirp.h b/src/qemu/qemu_slirp.h
index 507ea720fa..5a6a24b178 100644
--- a/src/qemu/qemu_slirp.h
+++ b/src/qemu/qemu_slirp.h
@@ -57,10 +57,6 @@ void qemuSlirpSetFeature(qemuSlirp *slirp,
bool qemuSlirpHasFeature(const qemuSlirp *slirp,
qemuSlirpFeature feature);
-int qemuSlirpOpen(qemuSlirp *slirp,
- virQEMUDriver *driver,
- virDomainDef *def);
-
int qemuSlirpStart(virDomainObj *vm,
virDomainNetDef *net,
bool incoming);
--
2.35.1