cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 5d232ea
Date Wed, 26 Aug 2015 08:49:22 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 858b6c025 -> 5d232ea3d


CLOUDSTACK-8749: Add checks to prevent malformed/unexpected input

Based on @jburwell's comment on PR #718

This closes #735

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7e455fa2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7e455fa2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7e455fa2

Branch: refs/heads/master
Commit: 7e455fa2b7968cac5c6e8813624d1a01cb43353d
Parents: 82df5b1
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Mon Aug 24 14:46:09 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Aug 26 13:34:21 2015 +0530

----------------------------------------------------------------------
 .../cloud/hypervisor/kvm/resource/BridgeVifDriver.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e455fa2/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
index dbc079d..2fab9a8 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
@@ -26,6 +26,7 @@ import java.util.regex.Pattern;
 
 import javax.naming.ConfigurationException;
 
+import com.google.common.base.Strings;
 import org.apache.log4j.Logger;
 import org.libvirt.LibvirtException;
 
@@ -275,7 +276,7 @@ public class BridgeVifDriver extends VifDriverBase {
         createControlNetwork(_bridges.get("linklocal"));
     }
 
-    private void deleteExitingLinkLocalRouteTable(String linkLocalBr) {
+    private void deleteExistingLinkLocalRouteTable(String linkLocalBr) {
         Script command = new Script("/bin/bash", _timeout);
         command.add("-c");
         command.add("ip route | grep " + NetUtils.getLinkLocalCIDR());
@@ -286,7 +287,11 @@ public class BridgeVifDriver extends VifDriverBase {
             String[] lines = parser.getLines().split("\\n");
             for (String line : lines) {
                 String[] tokens = line.split(" ");
-                if (!tokens[2].equalsIgnoreCase(linkLocalBr)) {
+                if (tokens != null && tokens.length < 2) {
+                    continue;
+                }
+                final String device = tokens[2];
+                if (!Strings.isNullOrEmpty(device) && !device.equalsIgnoreCase(linkLocalBr))
{
                     Script.runSimpleBashScript("ip route del " + NetUtils.getLinkLocalCIDR()
+ " dev " + tokens[2]);
                 } else {
                     foundLinkLocalBr = true;
@@ -300,7 +305,7 @@ public class BridgeVifDriver extends VifDriverBase {
     }
 
     private void createControlNetwork(String privBrName) {
-        deleteExitingLinkLocalRouteTable(privBrName);
+        deleteExistingLinkLocalRouteTable(privBrName);
         if (!isBridgeExists(privBrName)) {
             Script.runSimpleBashScript("brctl addbr " + privBrName + "; ip link set " + privBrName
+ " up; ip address add 169.254.0.1/16 dev " + privBrName, _timeout);
         }


Mime
View raw message