[libvirt] [PATCH 1/2] qemu: don't kill qemu process on restart if networkNotify fails

Laine Stump laine at laine.org
Tue Apr 25 16:33:59 UTC 2017


Nothing that could happen during networkNotifyActualDevice() could
justify unceremoniously killing the qemu process, but that's what we
were doing.

In particular, new code added in commit 85bcc022 (first appearred in
libvirt-3.2.0) attempts to reattach tap devices to their assigned
bridge devices when libvirtd restarts (to make it easier to recover
from a restart of a libvirt network). But if the network has been
stopped and *not* restarted, the bridge device won't exist and
networkNotifyActualDevice() will fail.

This patch changes qemuProcessNotifyNets() to return void, so that
qemuProcessReconnect() will soldier on regardless of what happens (any
errors will still be logged, but we won't terminate the guest).

Partially resolves: https://bugzilla.redhat.com/1442700
---

NB: there are many other things that might fail during reconnection of
a qemu process that shouldn't lead to killing the qemu
process. qemuProcessReconnect() could use a good audit to change what
happens when certain items fail.



 src/qemu/qemu_process.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 53170d7..fcb5763 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2825,7 +2825,7 @@ int qemuProcessStopCPUs(virQEMUDriverPtr driver,
 
 
 
-static int
+static void
 qemuProcessNotifyNets(virDomainDefPtr def)
 {
     size_t i;
@@ -2840,10 +2840,8 @@ qemuProcessNotifyNets(virDomainDefPtr def)
         if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT)
            ignore_value(virNetDevMacVLanReserveName(net->ifname, false));
 
-        if (networkNotifyActualDevice(def, net) < 0)
-            return -1;
+        networkNotifyActualDevice(def, net);
     }
-    return 0;
 }
 
 static int
@@ -3480,8 +3478,7 @@ qemuProcessReconnect(void *opaque)
     if (qemuSecurityReserveLabel(driver->securityManager, obj->def, obj->pid) < 0)
         goto error;
 
-    if (qemuProcessNotifyNets(obj->def) < 0)
-        goto error;
+    qemuProcessNotifyNets(obj->def);
 
     if (qemuProcessFiltersInstantiate(obj->def))
         goto error;
-- 
2.9.3




More information about the libvir-list mailing list