Blame SOURCES/libvirt-qemu-Ignore-nwfilter-binding-instantiation-issues-during-reconnect.patch

9c6c51
From d749a84b9728b4c1a46c9e6efbab5732688d03c2 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <d749a84b9728b4c1a46c9e6efbab5732688d03c2@dist-git>
9c6c51
From: John Ferlan <jferlan@redhat.com>
9c6c51
Date: Sat, 10 Nov 2018 08:50:06 -0500
9c6c51
Subject: [PATCH] qemu: Ignore nwfilter binding instantiation issues during
9c6c51
 reconnect
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1648544 (RHEL8)
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1607202 (RHEL7)
9c6c51
9c6c51
It's essentially stated in the nwfilterBindingDelete that we
9c6c51
will allow the admin to shoot themselves in the foot by deleting
9c6c51
the nwfilter binding which then allows them to undefine the
9c6c51
nwfilter that is in use for the running guest...
9c6c51
9c6c51
However, by allowing this we cause a problem for libvirtd
9c6c51
restart reconnect processing which would then try to recreate
9c6c51
the missing binding attempting to use the deleted filter
9c6c51
resulting in an error and thus shutting the guest down.
9c6c51
9c6c51
So rather than keep adding virDomainConfNWFilterInstantiate
9c6c51
flags to "ignore" specific error conditions, modify the logic
9c6c51
to ignore, but VIR_WARN errors other than ignoreExists. This
9c6c51
will at least allow the guest to not shutdown for only nwfilter
9c6c51
binding errors that we can now perhaps recover from since we
9c6c51
have the binding create/delete capability.
9c6c51
9c6c51
Signed-off-by: John Ferlan <jferlan@redhat.com>
9c6c51
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
9c6c51
(cherry picked from commit 9e52c6496650d1412662a9e6cf98301141fbbbca)
9c6c51
Reviewed-by: Erik Skultety <eskultet@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_process.c | 24 ++++++++++++++++--------
9c6c51
 1 file changed, 16 insertions(+), 8 deletions(-)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
9c6c51
index e4b19b938c..8ba14abfa4 100644
9c6c51
--- a/src/qemu/qemu_process.c
9c6c51
+++ b/src/qemu/qemu_process.c
9c6c51
@@ -3136,20 +3136,29 @@ qemuProcessNotifyNets(virDomainDefPtr def)
9c6c51
     }
9c6c51
 }
9c6c51
 
9c6c51
-static int
9c6c51
-qemuProcessFiltersInstantiate(virDomainDefPtr def, bool ignoreExists)
9c6c51
+/* Attempt to instantiate the filters. Ignore failures because it's
9c6c51
+ * possible that someone deleted a filter binding and the associated
9c6c51
+ * filter while the guest was running and we don't want that action
9c6c51
+ * to cause failure to keep the guest running during the reconnection
9c6c51
+ * processing. Nor do we necessarily want other failures to do the
9c6c51
+ * same. We'll just log the error conditions other than of course
9c6c51
+ * ignoreExists possibility (e.g. the true flag) */
9c6c51
+static void
9c6c51
+qemuProcessFiltersInstantiate(virDomainDefPtr def)
9c6c51
 {
9c6c51
     size_t i;
9c6c51
 
9c6c51
     for (i = 0; i < def->nnets; i++) {
9c6c51
         virDomainNetDefPtr net = def->nets[i];
9c6c51
         if ((net->filter) && (net->ifname)) {
9c6c51
-            if (virDomainConfNWFilterInstantiate(def->name, def->uuid, net, ignoreExists) < 0)
9c6c51
-                return 1;
9c6c51
+            if (virDomainConfNWFilterInstantiate(def->name, def->uuid, net,
9c6c51
+                                                 true) < 0) {
9c6c51
+                VIR_WARN("filter '%s' instantiation for '%s' failed '%s'",
9c6c51
+                         net->filter, net->ifname, virGetLastErrorMessage());
9c6c51
+                virResetLastError();
9c6c51
+            }
9c6c51
         }
9c6c51
     }
9c6c51
-
9c6c51
-    return 0;
9c6c51
 }
9c6c51
 
9c6c51
 static int
9c6c51
@@ -7782,8 +7791,7 @@ qemuProcessReconnect(void *opaque)
9c6c51
 
9c6c51
     qemuProcessNotifyNets(obj->def);
9c6c51
 
9c6c51
-    if (qemuProcessFiltersInstantiate(obj->def, true))
9c6c51
-        goto error;
9c6c51
+    qemuProcessFiltersInstantiate(obj->def);
9c6c51
 
9c6c51
     if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0)
9c6c51
         goto error;
9c6c51
-- 
9c6c51
2.19.2
9c6c51