You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by as...@apache.org on 2012/05/29 20:20:41 UTC
svn commit: r1343893 - in /whirr/trunk: CHANGES.txt
core/src/main/java/org/apache/whirr/Cluster.java
core/src/main/java/org/apache/whirr/service/FirewallManager.java
services/hadoop/src/main/resources/hadoop-metrics-ganglia.properties.vm
Author: asavu
Date: Tue May 29 18:20:41 2012
New Revision: 1343893
URL: http://svn.apache.org/viewvc?rev=1343893&view=rev
Log:
WHIRR-511. Instance.getPrivateHostName returns an IP address (asavu)
Modified:
whirr/trunk/CHANGES.txt
whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java
whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java
whirr/trunk/services/hadoop/src/main/resources/hadoop-metrics-ganglia.properties.vm
Modified: whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1343893&r1=1343892&r2=1343893&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Tue May 29 18:20:41 2012
@@ -127,6 +127,8 @@ Trunk (unreleased changes)
WHIRR-459. DNS Failure when trying to spawn HBase cluster (Alex Heneveld via asavu)
+ WHIRR-511. Instance.getPrivateHostName returns an IP address (asavu)
+
Release 0.7.1 - 2012-02-23
IMPROVEMENTS
Modified: whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java
URL: http://svn.apache.org/viewvc/whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java?rev=1343893&r1=1343892&r2=1343893&view=diff
==============================================================================
--- whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java (original)
+++ whirr/trunk/core/src/main/java/org/apache/whirr/Cluster.java Tue May 29 18:20:41 2012
@@ -85,8 +85,8 @@ public class Cluster {
this.id = checkNotNull(id, "id");
this.nodeMetadata = nodeMetadata;
this.dnsResolver = dnsResolver;
-
- LOG.debug("constructed instance {} with IP public {}, private {}, and DNS resolver {}",
+
+ LOG.debug("constructed instance {} with IP public {}, private {}, and DNS resolver {}",
new Object[] { this, publicIp, privateIp, dnsResolver });
}
@@ -132,13 +132,12 @@ public class Cluster {
return privateIp;
}
+ /**
+ * TODO Remove in version 0.9.0
+ */
+ @Deprecated
public synchronized String getPrivateHostName() throws IOException {
- if (privateHostName == null) {
- LOG.debug("resolving private hostname of {} (public {}, private {})", new Object[] { this, publicIp, privateIp });
- privateHostName = dnsResolver.apply(privateIp);
- LOG.debug("resolved private hostname of {} as {}", this, privateHostName);
- }
- return privateHostName;
+ return privateIp;
}
public String getId() {
Modified: whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java
URL: http://svn.apache.org/viewvc/whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java?rev=1343893&r1=1343892&r2=1343893&view=diff
==============================================================================
--- whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java (original)
+++ whirr/trunk/core/src/main/java/org/apache/whirr/service/FirewallManager.java Tue May 29 18:20:41 2012
@@ -46,19 +46,19 @@ import com.google.common.collect.Sets;
public class FirewallManager {
public static class Rule {
-
+
public static Rule create() {
return new Rule();
}
-
+
private String source;
private Set<Instance> destinations;
private Predicate<Instance> destinationPredicate;
private int[] ports;
-
+
private Rule() {
}
-
+
/**
* @param source The allowed source IP for traffic. If not set, this will
* default to {@link ClusterSpec#getClientCidrs()}, or, if that is not set,
@@ -68,7 +68,7 @@ public class FirewallManager {
this.source = source;
return this;
}
-
+
/**
* @param destination The allowed destination instance.
*/
@@ -76,7 +76,7 @@ public class FirewallManager {
this.destinations = Collections.singleton(destination);
return this;
}
-
+
/**
* @param destinations The allowed destination instances.
*/
@@ -84,7 +84,7 @@ public class FirewallManager {
this.destinations = destinations;
return this;
}
-
+
/**
* @param destinationPredicate A predicate which is used to evaluate the
* allowed destination instances.
@@ -93,7 +93,7 @@ public class FirewallManager {
this.destinationPredicate = destinationPredicate;
return this;
}
-
+
/**
* @param port The port on the destination which is to be opened. Overrides
* any previous calls to {@link #port(int)} or {@link #ports(int...)}.
@@ -102,7 +102,7 @@ public class FirewallManager {
this.ports = new int[] { port };
return this;
}
-
+
/**
* @param ports The ports on the destination which are to be opened.
* Overrides
@@ -139,14 +139,14 @@ public class FirewallManager {
addRule(rule);
}
}
-
+
/**
* Rules are additive. If no source is set then it will default
* to {@link ClusterSpec#getClientCidrs()}, or, if that is not set,
* to the client's originating IP. If no destinations or ports
* are set then the rule has not effect.
*
- * @param rule The rule to add to the firewall.
+ * @param rule The rule to add to the firewall.
* @throws IOException
*/
public void addRule(Rule rule) throws IOException {
@@ -187,6 +187,10 @@ public class FirewallManager {
* @throws IOException
*/
private String getOriginatingIp() throws IOException {
+ if ("stub".equals(clusterSpec.getProvider())) {
+ return "62.217.232.123";
+ }
+
URL url = new URL("http://checkip.amazonaws.com/");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
Modified: whirr/trunk/services/hadoop/src/main/resources/hadoop-metrics-ganglia.properties.vm
URL: http://svn.apache.org/viewvc/whirr/trunk/services/hadoop/src/main/resources/hadoop-metrics-ganglia.properties.vm?rev=1343893&r1=1343892&r2=1343893&view=diff
==============================================================================
--- whirr/trunk/services/hadoop/src/main/resources/hadoop-metrics-ganglia.properties.vm (original)
+++ whirr/trunk/services/hadoop/src/main/resources/hadoop-metrics-ganglia.properties.vm Tue May 29 18:20:41 2012
@@ -10,7 +10,7 @@
## See the License for the specific language governing permissions and
## limitations under the License.
##
-#set( $GMETAD_HOST = $cluster.getInstancesMatching($RolePredicates.role("ganglia-metad")).iterator().next().getPrivateHostName() )
+#set( $GMETAD_HOST = $cluster.getInstancesMatching($RolePredicates.role("ganglia-metad")).iterator().next().getPrivateIp() )
dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
dfs.period=10
dfs.servers=$GMETAD_HOST:8649