libvirt/libvirt-qemu_interface-Fix-managed-no-case-when-creating-an-ethernet-interface.patch
Jiri Denemark 86af401d07 libvirt-9.0.0-2.el9
- vircgroupv2: fix cpu.weight limits check (rhbz#2037998)
- domain_validate: drop cpu.shares cgroup check (rhbz#2037998)
- docs: document correct cpu shares limits with both cgroups v1 and v2 (rhbz#2037998)
- qemu_interface: Fix managed='no' case when creating an ethernet interface (rhbz#2144738)
- conf: clarify some external TPM error messages (rhbz#2063723)
- qemu: hotplug: Remove legacy quirk for 'dimm' address generation (rhbz#2158701)
- qemu: alias: Remove 'oldAlias' argument of qemuAssignDeviceMemoryAlias (rhbz#2158701)
- qemu: Remove 'memAliasOrderMismatch' field from VM private data (rhbz#2158701)
- rpc: Fix error message in virNetServerSetClientLimits (rhbz#2033879)

Resolves: rhbz#2033879, rhbz#2037998, rhbz#2063723, rhbz#2144738, rhbz#2158701
2023-01-25 10:13:33 +01:00

57 lines
2.2 KiB
Diff

From 25de0ead0194159a6d9a769f34ec5b092e9b718c Mon Sep 17 00:00:00 2001
Message-Id: <25de0ead0194159a6d9a769f34ec5b092e9b718c@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 23 Jan 2023 11:42:18 +0100
Subject: [PATCH] qemu_interface: Fix managed='no' case when creating an
ethernet interface
In a recent commit of v9.0.0-rc1~192 I've tried to forbid case
where a TAP device already exists, but at the same time it's
managed by Libvirt (<interface type='ethernet'> <target
dev='tap0' managed='yes'/> </interface>). NB, if @managed
attribute is missing then it's assumed to be managed by Libvirt.
Anyway, I've mistakenly put setting of
VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag into managed='yes'
branch instead of managed='no' branch in
qemuInterfaceEthernetConnect().
Move the setting of the flag into the correct branch.
Fixes: a2ae3d299cf9c5ada8aa42ec4271748eb479dc27
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit d6a8b9eef70887e01fa5fd292580e14ca5eab08c)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2144738
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_interface.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index b6895cedde..ed2c209167 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -443,6 +443,9 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
_("target managed='no' but specified dev doesn't exist"));
goto cleanup;
}
+
+ tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
+
if (virNetDevMacVLanIsMacvtap(net->ifname)) {
auditdev = net->ifname;
if (virNetDevMacVLanTapOpen(net->ifname, tapfd, tapfdSize) < 0)
@@ -461,8 +464,6 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
if (!net->ifname)
template_ifname = true;
- tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
-
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
tap_create_flags) < 0) {
goto cleanup;
--
2.39.1