Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
WHIRR-233. Change test properties to be less provider bound and impro…
Browse files Browse the repository at this point in the history
…ve TemplateBuilder defaults

git-svn-id: https://svn.apache.org/repos/asf/incubator/whirr/trunk@1082723 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Andrei Savu committed Mar 17, 2011
1 parent 9463ccf commit e62ca8c
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 98 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Expand Up @@ -59,6 +59,9 @@ Release 0.4.0 - 2011-03-15
WHIRR-259. Disable configuration list handling for Hadoop
properties (asavu)

WHIRR-233. Change test properties to be less provider bound and
improve TemplateBuilder defaults (asavu)

BUG FIXES

WHIRR-170. Instances should be started in the order specified in
Expand Down
14 changes: 14 additions & 0 deletions core/src/main/java/org/apache/whirr/service/ClusterSpec.java
Expand Up @@ -121,6 +121,9 @@ public enum Property {

HARDWARE_ID(String.class, false, "The type of hardware to use for" +
" the instance. This must be compatible with the image ID."),

HARDWARE_MIN_RAM(Integer.class, false, "The minimum amount of " +
"instance memory. E.g. 1024"),

LOCATION_ID(String.class, false, "The location to launch " +
"instances in. If not specified then an arbitrary location " +
Expand Down Expand Up @@ -370,6 +373,7 @@ public static ClusterSpec withNoDefaults(Configuration conf)
private String publicKey;
private String imageId;
private String hardwareId;
private int hardwareMinRam;
private String locationId;
private List<String> clientCidrs;
private String version;
Expand Down Expand Up @@ -439,6 +443,7 @@ public ClusterSpec(Configuration config, boolean loadDefaults)

setImageId(config.getString(Property.IMAGE_ID.getConfigName()));
setHardwareId(config.getString(Property.HARDWARE_ID.getConfigName()));
setHardwareMinRam(c.getInteger(Property.HARDWARE_MIN_RAM.getConfigName(), 1024));
setLocationId(config.getString(Property.LOCATION_ID.getConfigName()));
setClientCidrs(c.getList(Property.CLIENT_CIDRS.getConfigName()));
setVersion(c.getString(Property.VERSION.getConfigName()));
Expand Down Expand Up @@ -513,6 +518,9 @@ public String getImageId() {
public String getHardwareId() {
return hardwareId;
}
public int getHardwareMinRam() {
return hardwareMinRam;
}
public String getLocationId() {
return locationId;
}
Expand Down Expand Up @@ -628,6 +636,10 @@ public void setImageId(String imageId) {
public void setHardwareId(String hardwareId) {
this.hardwareId = hardwareId;
}

public void setHardwareMinRam(int minRam) {
this.hardwareMinRam = minRam;
}

public void setLocationId(String locationId) {
this.locationId = locationId;
Expand Down Expand Up @@ -687,6 +699,7 @@ public boolean equals(Object o) {
&& Objects.equal(clusterName, that.clusterName)
&& Objects.equal(imageId, that.imageId)
&& Objects.equal(hardwareId, that.hardwareId)
&& Objects.equal(hardwareMinRam, that.hardwareMinRam)
&& Objects.equal(locationId, that.locationId)
&& Objects.equal(clientCidrs, that.clientCidrs)
&& Objects.equal(version, that.version)
Expand Down Expand Up @@ -715,6 +728,7 @@ public String toString() {
.add("privateKey", privateKey)
.add("imageId", imageId)
.add("instanceSizeId", hardwareId)
.add("instanceMinRam", hardwareMinRam)
.add("locationId", locationId)
.add("clientCidrs", clientCidrs)
.add("version", version)
Expand Down
Expand Up @@ -19,6 +19,7 @@
package org.apache.whirr.service.jclouds;

import org.apache.whirr.service.ClusterSpec;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.TemplateBuilder;

/**
Expand All @@ -28,13 +29,21 @@ public class TemplateBuilderStrategy {

public void configureTemplateBuilder(ClusterSpec clusterSpec,
TemplateBuilder templateBuilder) {

if (clusterSpec.getImageId() != null) {
templateBuilder.imageId(clusterSpec.getImageId());
} else {
templateBuilder.os64Bit(true);
templateBuilder.osFamily(OsFamily.UBUNTU);
templateBuilder.osVersionMatches("10.04");
}

if (clusterSpec.getHardwareId() != null) {
templateBuilder.hardwareId(clusterSpec.getHardwareId());
} else if(clusterSpec.getHardwareMinRam() != 0) {
templateBuilder.minRam(clusterSpec.getHardwareMinRam());
} else {
templateBuilder.minRam(1024);
}

if (clusterSpec.getLocationId() != null) {
Expand Down
Expand Up @@ -20,3 +20,4 @@ whirr.instance-templates=2 cassandra
whirr.provider=${sys:whirr.test.provider}
whirr.identity=${sys:whirr.test.identity}
whirr.credential=${sys:whirr.test.credential}
whirr.hardware-min-ram=512
Expand Up @@ -52,7 +52,6 @@ protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
addStatement(event, call("install_java"));
addStatement(event, call("install_tarball"));
addStatement(event, call(hadoopInstallFunction, "-c", clusterSpec.getProvider()));
event.setTemplateBuilderStrategy(new HadoopTemplateBuilderStrategy());
}

@Override
Expand Down
Expand Up @@ -73,7 +73,6 @@ protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
addStatement(event, call("install_java"));
addStatement(event, call("install_tarball"));
addStatement(event, call(hadoopInstallFunction, "-c", clusterSpec.getProvider()));
event.setTemplateBuilderStrategy(new HadoopTemplateBuilderStrategy());
}

@Override
Expand Down

This file was deleted.

Expand Up @@ -67,7 +67,6 @@ protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
addStatement(event, call(hbaseInstallFunction,
HBaseConstants.PARAM_PROVIDER, clusterSpec.getProvider(),
HBaseConstants.PARAM_TARBALL_URL, tarurl));
event.setTemplateBuilderStrategy(new HBaseTemplateBuilderStrategy());
}

@Override
Expand Down
Expand Up @@ -73,7 +73,6 @@ protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
addStatement(event, call(hbaseInstallFunction,
HBaseConstants.PARAM_PROVIDER, clusterSpec.getProvider(),
HBaseConstants.PARAM_TARBALL_URL, tarurl));
event.setTemplateBuilderStrategy(new HBaseTemplateBuilderStrategy());
}

@Override
Expand Down
Expand Up @@ -60,7 +60,6 @@ protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
addStatement(event, call(hbaseInstallFunction,
HBaseConstants.PARAM_PROVIDER, clusterSpec.getProvider(),
HBaseConstants.PARAM_TARBALL_URL, tarurl));
event.setTemplateBuilderStrategy(new HBaseTemplateBuilderStrategy());
}

@Override
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions services/hbase/src/test/resources/whirr-hbase-test.properties
Expand Up @@ -20,10 +20,4 @@ whirr.instance-templates=1 zookeeper,1 hadoop-namenode+hadoop-jobtracker+hbase-m
whirr.provider=${sys:whirr.test.provider}
whirr.identity=${sys:whirr.test.identity}
whirr.credential=${sys:whirr.test.credential}
whirr.private-key-file=${sys:user.home}/.ssh/id_rsa
# enforce large instance during the test
whirr.hardware-id=m1.large
# Ubuntu 10.04 LTS Lucid instance-store - see http://alestic.com/
whirr.image-id=us-east-1/ami-da0cf8b3
whirr.location-id=us-east-1
whirr.hbase.tarball.url=http://archive.apache.org/dist/hbase/hbase-0.89.20100924/hbase-0.89.20100924-bin.tar.gz
Expand Up @@ -20,3 +20,4 @@ whirr.instance-templates=2 zookeeper
whirr.provider=${sys:whirr.test.provider}
whirr.identity=${sys:whirr.test.identity}
whirr.credential=${sys:whirr.test.credential}
whirr.hardware-min-ram=512

0 comments on commit e62ca8c

Please sign in to comment.