diff --git a/d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch b/d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch new file mode 100644 index 0000000..157dea9 --- /dev/null +++ b/d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch @@ -0,0 +1,50 @@ +From 9f09c5b36cc9c97c508aeb60ed268d2e04367877 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +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 ( ). 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 +Reviewed-by: Martin Kletzander +(cherry picked from commit d6a8b9eef70887e01fa5fd292580e14ca5eab08c) +--- + src/qemu/qemu_interface.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: libvirt-9.0.0/src/qemu/qemu_interface.c +=================================================================== +--- libvirt-9.0.0.orig/src/qemu/qemu_interface.c ++++ libvirt-9.0.0/src/qemu/qemu_interface.c +@@ -443,6 +443,9 @@ qemuInterfaceEthernetConnect(virDomainDe + _("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(virDomainDe + 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; diff --git a/libvirt.changes b/libvirt.changes index a8be0f1..3bdfc97 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -6,7 +6,8 @@ Tue Jan 17 17:33:00 UTC 2023 - James Fehlig - Many incremental improvements and bug fixes, see https://libvirt.org/news.html#v9-0-0-2023-01-16 - Added patches: - ef482951-apparmor-Allow-umount-dev.patch + ef482951-apparmor-Allow-umount-dev.patch, + d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch ------------------------------------------------------------------- Tue Dec 27 17:49:38 UTC 2022 - James Fehlig diff --git a/libvirt.spec b/libvirt.spec index db7668e..48e1012 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -305,6 +305,7 @@ Source99: baselibs.conf Source100: %{name}-rpmlintrc # Upstream patches Patch0: ef482951-apparmor-Allow-umount-dev.patch +Patch1: d6a8b9ee-qemu-Fix-managed-no-when-creating-ethdev.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch