You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/11/18 16:52:59 UTC

[1/2] git commit: updated refs/heads/master to f2ccee7

Repository: cloudstack
Updated Branches:
  refs/heads/master 22ad646ac -> f2ccee7a0


CID-1254832 tyr-with-resource


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

Branch: refs/heads/master
Commit: 6bc0defa1d30d4ca3a5a0260bb215147189763e1
Parents: 22ad646
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Nov 18 15:48:31 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Nov 18 15:48:31 2014 +0100

----------------------------------------------------------------------
 .../apache/cloudstack/utils/graphite/GraphiteClient.java    | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6bc0defa/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java b/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java
index 6fbd4c3..3338ccf 100644
--- a/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java
+++ b/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java
@@ -78,17 +78,14 @@ public class GraphiteClient {
      * @param timeStamp the timestamp
      */
     public void sendMetrics(Map<String, Integer> metrics, long timeStamp) {
-        try {
-            DatagramSocket sock = new DatagramSocket();
-            InetAddress addr = InetAddress.getByName(graphiteHost);
+        try (DatagramSocket sock = new DatagramSocket()){
+            InetAddress addr = InetAddress.getByName(this.graphiteHost);
 
             for (Map.Entry<String, Integer> metric: metrics.entrySet()) {
                 byte[] message = new String(metric.getKey() + " " + metric.getValue() + " " + timeStamp + "\n").getBytes();
                 DatagramPacket packet = new DatagramPacket(message, message.length, addr, graphitePort);
                 sock.send(packet);
             }
-
-            sock.close();
         } catch (UnknownHostException e) {
             throw new GraphiteException("Unknown host: " + graphiteHost);
         } catch (IOException e) {
@@ -122,4 +119,4 @@ public class GraphiteClient {
         metrics.put(key, value);
         sendMetrics(metrics, timeStamp);
     }
-}
\ No newline at end of file
+}


[2/2] git commit: updated refs/heads/master to f2ccee7

Posted by da...@apache.org.
name convention adherence


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

Branch: refs/heads/master
Commit: f2ccee7a030a9e69a3180c30806a35882a3a4293
Parents: 6bc0def
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Nov 18 16:52:46 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Nov 18 16:52:46 2014 +0100

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java     | 16 ++++++++--------
 utils/src/com/cloud/utils/net/NetUtils.java         | 14 +++++++-------
 2 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f2ccee7a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 2cb4203..57b50e6 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2777,17 +2777,17 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
         });
     }
 
-    public NetUtils.supersetOrSubset checkIfSubsetOrSuperset(String newVlanGateway, String newVlanNetmask, VlanVO vlan, String startIP, String endIP) {
+    public NetUtils.SupersetOrSubset checkIfSubsetOrSuperset(String newVlanGateway, String newVlanNetmask, VlanVO vlan, String startIP, String endIP) {
         if (newVlanGateway == null && newVlanNetmask == null) {
             newVlanGateway = vlan.getVlanGateway();
             newVlanNetmask = vlan.getVlanNetmask();
             // this means he is trying to add to the existing subnet.
             if (NetUtils.sameSubnet(startIP, newVlanGateway, newVlanNetmask)) {
                 if (NetUtils.sameSubnet(endIP, newVlanGateway, newVlanNetmask)) {
-                    return NetUtils.supersetOrSubset.sameSubnet;
+                    return NetUtils.SupersetOrSubset.sameSubnet;
                 }
             }
-            return NetUtils.supersetOrSubset.neitherSubetNorSuperset;
+            return NetUtils.SupersetOrSubset.neitherSubetNorSuperset;
         } else if (newVlanGateway == null || newVlanNetmask == null) {
             throw new InvalidParameterValueException(
                     "either both netmask and gateway should be passed or both should me omited.");
@@ -2816,22 +2816,22 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
                     vlanGateway = vlan.getVlanGateway();
                     vlanNetmask = vlan.getVlanNetmask();
                     // check if subset or super set or neither.
-                    NetUtils.supersetOrSubset val = checkIfSubsetOrSuperset(newVlanGateway, newVlanNetmask, vlan, startIP, endIP);
-                    if (val == NetUtils.supersetOrSubset.isSuperset) {
+                    NetUtils.SupersetOrSubset val = checkIfSubsetOrSuperset(newVlanGateway, newVlanNetmask, vlan, startIP, endIP);
+                    if (val == NetUtils.SupersetOrSubset.isSuperset) {
                         // this means that new cidr is a superset of the
                         // existing subnet.
                         throw new InvalidParameterValueException("The subnet you are trying to add is a superset of the existing subnet having gateway" + vlan.getVlanGateway()
                                 + " and netmask  " + vlan.getVlanNetmask());
-                    } else if (val == NetUtils.supersetOrSubset.neitherSubetNorSuperset) {
+                    } else if (val == NetUtils.SupersetOrSubset.neitherSubetNorSuperset) {
                         // this implies the user is trying to add a new subnet
                         // which is not a superset or subset of this subnet.
                         // checking with the other subnets.
                         continue;
-                    } else if (val == NetUtils.supersetOrSubset.isSubset) {
+                    } else if (val == NetUtils.SupersetOrSubset.isSubset) {
                         // this means he is trying to add to the same subnet.
                         throw new InvalidParameterValueException("The subnet you are trying to add is a subset of the existing subnet having gateway" + vlan.getVlanGateway()
                                 + " and netmask  " + vlan.getVlanNetmask());
-                    } else if (val == NetUtils.supersetOrSubset.sameSubnet) {
+                    } else if (val == NetUtils.SupersetOrSubset.sameSubnet) {
                         sameSubnet = true;
                         //check if the gateway provided by the user is same as that of the subnet.
                         if (newVlanGateway != null && !newVlanGateway.equals(vlanGateway)) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f2ccee7a/utils/src/com/cloud/utils/net/NetUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java
index 3ce3697..1f41825 100755
--- a/utils/src/com/cloud/utils/net/NetUtils.java
+++ b/utils/src/com/cloud/utils/net/NetUtils.java
@@ -824,17 +824,17 @@ public class NetUtils {
         return new Pair<String, Integer>(tokens[0], Integer.parseInt(tokens[1]));
     }
 
-    public static enum supersetOrSubset {
+    public static enum SupersetOrSubset {
         isSuperset, isSubset, neitherSubetNorSuperset, sameSubnet, errorInCidrFormat
     }
 
-    public static supersetOrSubset isNetowrkASubsetOrSupersetOfNetworkB(String cidrA, String cidrB) {
+    public static SupersetOrSubset isNetowrkASubsetOrSupersetOfNetworkB(String cidrA, String cidrB) {
         Long[] cidrALong = cidrToLong(cidrA);
         Long[] cidrBLong = cidrToLong(cidrB);
         long shift = 0;
         if (cidrALong == null || cidrBLong == null) {
             //implies error in the cidr format
-            return supersetOrSubset.errorInCidrFormat;
+            return SupersetOrSubset.errorInCidrFormat;
         }
         if (cidrALong[1] >= cidrBLong[1]) {
             shift = 32 - cidrBLong[1];
@@ -845,16 +845,16 @@ public class NetUtils {
         if (result == 0) {
             if (cidrALong[1] < cidrBLong[1]) {
                 //this implies cidrA is super set of cidrB
-                return supersetOrSubset.isSuperset;
+                return SupersetOrSubset.isSuperset;
             } else if (cidrALong[1].equals(cidrBLong[1])) {
                 //this implies both the cidrs are equal
-                return supersetOrSubset.sameSubnet;
+                return SupersetOrSubset.sameSubnet;
             }
             // implies cidrA is subset of cidrB
-            return supersetOrSubset.isSubset;
+            return SupersetOrSubset.isSubset;
         }
         //this implies no overlap.
-        return supersetOrSubset.neitherSubetNorSuperset;
+        return SupersetOrSubset.neitherSubetNorSuperset;
     }
 
     public static boolean isNetworkAWithinNetworkB(String cidrA, String cidrB) {