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

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