You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/12/06 08:34:56 UTC
[cloudstack] branch master updated: kvm: Use 'ip route show default
0.0.0.0/0' to find the default gateway (#3080)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new d96bc05 kvm: Use 'ip route show default 0.0.0.0/0' to find the default gateway (#3080)
d96bc05 is described below
commit d96bc05d10d0e5ca8f6e232e8de68398dadf8afb
Author: Wido den Hollander <wi...@widodh.nl>
AuthorDate: Thu Dec 6 09:34:47 2018 +0100
kvm: Use 'ip route show default 0.0.0.0/0' to find the default gateway (#3080)
If a host has many routes this can be a magnitude faster then printing
all the routes and grepping for the default.
In some situations the host might have a large amount of routes due to
dynamic routing being used like OSPF or BGP.
In addition fix a couple of loglines which were throwing messages on
DEBUG while WARN and ERROR should be used there.
Signed-off-by: Wido den Hollander <wi...@widodh.nl>
---
.../cloud/hypervisor/kvm/resource/LibvirtComputingResource.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 26fcd01..cf6f610 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -1015,21 +1015,21 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
*/
if (_pifs.get("private") == null) {
- s_logger.debug("Failed to get private nic name");
+ s_logger.error("Failed to get private nic name");
throw new ConfigurationException("Failed to get private nic name");
}
if (_pifs.get("public") == null) {
- s_logger.debug("Failed to get public nic name");
+ s_logger.error("Failed to get public nic name");
throw new ConfigurationException("Failed to get public nic name");
}
s_logger.debug("Found pif: " + _pifs.get("private") + " on " + _privBridgeName + ", pif: " + _pifs.get("public") + " on " + _publicBridgeName);
_canBridgeFirewall = canBridgeFirewall(_pifs.get("public"));
- _localGateway = Script.runSimpleBashScript("ip route |grep default|awk '{print $3}'");
+ _localGateway = Script.runSimpleBashScript("ip route show default 0.0.0.0/0|head -1|awk '{print $3}'");
if (_localGateway == null) {
- s_logger.debug("Failed to found the local gateway");
+ s_logger.warn("No default IPv4 gateway found");
}
_mountPoint = (String)params.get("mount.path");