Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 8 +++-----
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_domain.h | 2 +-
src/qemu/qemu_hotplug.c | 4 ++--
src/qemu/qemu_interface.c | 8 ++------
tests/qemuxml2argvmock.c | 10 +++-------
6 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a52ba70066..ed7f0eafd2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4260,7 +4260,7 @@ qemuBuildHostNetProps(virDomainNetDef *net)
nfds = 0;
for (n = netpriv->vhostfds; n; n = n->next) {
- virBufferAsprintf(&buf, "%s:",
qemuFDPassGetPath(n->data));
+ virBufferAsprintf(&buf, "%s:",
qemuFDPassDirectGetPath(n->data));
nfds++;
}
@@ -8916,10 +8916,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver,
return -1;
}
- for (n = netpriv->vhostfds; n; n = n->next) {
- if (qemuFDPassTransferCommand(n->data, cmd) < 0)
- return -1;
- }
+ for (n = netpriv->vhostfds; n; n = n->next)
+ qemuFDPassDirectTransferCommand(n->data, cmd);
if (qemuFDPassTransferCommand(netpriv->slirpfd, cmd) < 0 ||
qemuFDPassTransferCommand(netpriv->vdpafd, cmd) < 0)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4305d5db06..eba556a6e7 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1053,7 +1053,7 @@ qemuDomainNetworkPrivateClearFDs(qemuDomainNetworkPrivate *priv)
g_clear_pointer(&priv->slirpfd, qemuFDPassFree);
g_clear_pointer(&priv->vdpafd, qemuFDPassFree);
- g_slist_free_full(g_steal_pointer(&priv->vhostfds), (GDestroyNotify)
qemuFDPassFree);
+ g_slist_free_full(g_steal_pointer(&priv->vhostfds), (GDestroyNotify)
qemuFDPassDirectFree);
g_slist_free_full(g_steal_pointer(&priv->tapfds), (GDestroyNotify)
qemuFDPassFree);
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index e9eda8903e..9475c30e0c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -405,7 +405,7 @@ struct _qemuDomainNetworkPrivate {
/* file descriptor transfer helpers */
qemuFDPass *slirpfd;
GSList *tapfds;
- GSList *vhostfds;
+ GSList *vhostfds; /* qemuFDPassDirect */
qemuFDPass *vdpafd;
};
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index cae7b0dd3b..da0896a671 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1380,7 +1380,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
}
for (n = netpriv->vhostfds; n; n = n->next) {
- if (qemuFDPassTransferMonitor(n->data, priv->mon) < 0) {
+ if (qemuFDPassDirectTransferMonitor(n->data, priv->mon) < 0) {
qemuDomainObjExitMonitor(vm);
goto cleanup;
}
@@ -1528,7 +1528,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
qemuFDPassTransferMonitorRollback(n->data, priv->mon);
for (n = netpriv->vhostfds; n; n = n->next)
- qemuFDPassTransferMonitorRollback(n->data, priv->mon);
+ qemuFDPassDirectTransferMonitorRollback(n->data, priv->mon);
qemuDomainObjExitMonitor(vm);
virErrorRestore(&originalError);
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index bda96808eb..ba03277025 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -700,12 +700,10 @@ int
qemuInterfaceOpenVhostNet(virDomainObj *vm,
virDomainNetDef *net)
{
- qemuDomainObjPrivate *priv = vm->privateData;
qemuDomainNetworkPrivate *netpriv = QEMU_DOMAIN_NETWORK_PRIVATE(net);
size_t i;
const char *vhostnet_path = net->backend.vhost;
size_t vhostfdSize = net->driver.virtio.queues;
- g_autofree char *prefix = g_strdup_printf("vhostfd-%s",
net->info.alias);
if (!vhostfdSize)
vhostfdSize = 1;
@@ -743,8 +741,7 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm,
for (i = 0; i < vhostfdSize; i++) {
VIR_AUTOCLOSE fd = open(vhostnet_path, O_RDWR);
- g_autoptr(qemuFDPass) pass = qemuFDPassNewDirect(prefix, priv);
- g_autofree char *suffix = g_strdup_printf("%zu", i);
+ g_autofree char *name = g_strdup_printf("vhostfd-%s%zu",
net->info.alias, i);
/* If the config says explicitly to use vhost and we couldn't open it,
* report an error.
@@ -761,8 +758,7 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm,
break;
}
- qemuFDPassAddFD(pass, &fd, suffix);
- netpriv->vhostfds = g_slist_prepend(netpriv->vhostfds,
g_steal_pointer(&pass));
+ netpriv->vhostfds = g_slist_prepend(netpriv->vhostfds,
qemuFDPassDirectNew(name, &fd));
}
netpriv->vhostfds = g_slist_reverse(netpriv->vhostfds);
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index aa82ffa2d6..bb14f775f3 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -226,12 +226,10 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path
G_GNUC_UNUSED,
}
int
-qemuInterfaceOpenVhostNet(virDomainObj *vm,
+qemuInterfaceOpenVhostNet(virDomainObj *vm G_GNUC_UNUSED,
virDomainNetDef *net)
{
- qemuDomainObjPrivate *priv = vm->privateData;
qemuDomainNetworkPrivate *netpriv = QEMU_DOMAIN_NETWORK_PRIVATE(net);
- g_autofree char *prefix = g_strdup_printf("vhostfd-%s",
net->info.alias);
size_t vhostfdSize = net->driver.virtio.queues;
size_t i;
@@ -242,12 +240,10 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm,
return 0;
for (i = 0; i < vhostfdSize; i++) {
- g_autoptr(qemuFDPass) pass = qemuFDPassNewDirect(prefix, priv);
- g_autofree char *suffix = g_strdup_printf("%zu", i);
+ g_autofree char *name = g_strdup_printf("vhostfd-%s%zu",
net->info.alias, i);
int fd = STDERR_FILENO + 42 + i;
- qemuFDPassAddFD(pass, &fd, suffix);
- netpriv->vhostfds = g_slist_prepend(netpriv->vhostfds,
g_steal_pointer(&pass));
+ netpriv->vhostfds = g_slist_prepend(netpriv->vhostfds,
qemuFDPassDirectNew(name, &fd));
}
netpriv->vhostfds = g_slist_reverse(netpriv->vhostfds);
--
2.35.3