]> xenbits.xensource.com Git - libvirt.git/commitdiff
network: better log message when network is inactive during reconnect
authorLaine Stump <laine@laine.org>
Tue, 25 Apr 2017 16:26:43 +0000 (12:26 -0400)
committerLaine Stump <laine@laine.org>
Fri, 28 Apr 2017 13:41:46 +0000 (09:41 -0400)
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

src/network/bridge_driver.c

index d18b15b71e3d2c95723152e560aad3c98b0870d8..3ba70180b865a96693abc41cd32062c4ec263337 100644 (file)
@@ -4675,6 +4675,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