render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From c85276bfbfda6818ae1dddbe91d971cb26669044 Mon Sep 17 00:00:00 2001
Message-Id: <c85276bfbfda6818ae1dddbe91d971cb26669044@dist-git>
From: Laine Stump <laine@laine.org>
Date: Tue, 2 May 2017 12:31:52 -0400
Subject: [PATCH] network: better log message when network is inactive during
 reconnect

If the network isn't active during networkNotifyActualDevice(), we
would log an error message stating that the bridge device didn't
exist. This patch adds a check to see if the network is active, making
the logs more useful in the case that it isn't.

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

(cherry picked from commit 7949de960eaba07661c1e0ab6e4aa945db8c1b25)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/network/bridge_driver.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index cb91a2c90..41bce794a 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -4682,6 +4682,13 @@ networkNotifyActualDevice(virDomainDefPtr dom,
     }
     netdef = network->def;
 
+    if (!virNetworkObjIsActive(network)) {
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("network '%s' is not active"),
+                       netdef->name);
+        goto error;
+    }
+
     /* if we're restarting libvirtd after an upgrade from a version
      * that didn't save bridge name in actualNetDef for
      * actualType==network, we need to copy it in so that it will be
-- 
2.12.2