From efdf8b23bb753f445b02b175cdb9f493d361ade2 Mon Sep 17 00:00:00 2001 From: Mattias Holmqvist Date: Sun, 11 Sep 2011 22:01:36 +0200 Subject: [PATCH 1/5] Fix: "auto" no longer being assigned to public IP of the node when the node has been started. --- .../ElasticStackComputeServiceAdapter.java | 6 +++-- .../functions/ServerInfoToNodeMetadata.java | 2 +- .../elasticstack/functions/MapToNICs.java | 20 +++++++++++----- .../functions/MapToServerInfo.java | 24 ++++++------------- .../functions/MapToServerInfoTest.java | 9 +++++-- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java index f55af06d1c..ef728fc0a5 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java @@ -123,10 +123,12 @@ public class ElasticStackComputeServiceAdapter implements Server toCreate = small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam()).cpu( (int) (template.getHardware().getProcessors().get(0).getSpeed())).build(); - ServerInfo from = client.createAndStartServer(toCreate); + ServerInfo from = client.createServer(toCreate); + client.startServer(from.getUuid()); + from = client.getServerInfo(from.getUuid()); // store the credentials so that later functions can use them credentialStore.put(from.getUuid() + "", new Credentials(template.getImage().getDefaultCredentials().identity, - from.getVnc().getPassword())); + from.getVnc().getPassword())); return from; } diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java index 0dee09829c..0f46ff743b 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java @@ -104,7 +104,7 @@ public class ServerInfoToNodeMetadata implements Function of(from.getVnc().getIp())); + builder.publicAddresses(ImmutableSet. of(from.getNics().get(0).getDhcp())); builder.privateAddresses(ImmutableSet. of()); builder.credentials(credentialStore.get(from.getUuid())); return builder.build(); diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToNICs.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToNICs.java index 2b65d92233..f93fb0203b 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToNICs.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToNICs.java @@ -53,13 +53,10 @@ public class MapToNICs implements Function, List> { String key = String.format("nic:%d", id); if (!from.containsKey(key + ":model")) break NIC; + NIC.Builder nicBuilder = new NIC.Builder(); - - if (apiVersion.equals("2.0")) { - nicBuilder.dhcp(from.get(key + ":dhcp:ip")); - } else { - nicBuilder.dhcp(from.get(key + ":dhcp")); - } + final String ip = getDhcpIp(from, key); + nicBuilder.dhcp(ip); nicBuilder.model(Model.fromValue(from.get(key + ":model"))); nicBuilder.vlan(from.get(key + ":vlan")); nicBuilder.mac(from.get(key + ":mac")); @@ -67,6 +64,17 @@ public class MapToNICs implements Function, List> { nicBuilder.block(Splitter.on(' ').split(from.get(key + ":block"))); nics.add(nicBuilder.build()); } + return nics.build(); } + + private String getDhcpIp(Map from, String key) { + if (apiVersion.equals("2.0")) { + final String ip = from.get(key + ":dhcp:ip"); + return (ip == null ? "auto" : ip); + } else { + final String ip = from.get(key + ":dhcp"); + return (ip == null ? "auto" : ip); + } + } } \ No newline at end of file diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java index 26affbe3a3..c82376015b 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java @@ -18,32 +18,23 @@ */ package org.jclouds.elasticstack.functions; +import com.google.common.base.Function; +import com.google.common.base.Splitter; +import com.google.common.collect.Maps; +import org.jclouds.elasticstack.domain.*; + +import javax.inject.Inject; +import javax.inject.Singleton; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.elasticstack.domain.Device; -import org.jclouds.elasticstack.domain.NIC; -import org.jclouds.elasticstack.domain.ServerInfo; -import org.jclouds.elasticstack.domain.ServerMetrics; -import org.jclouds.elasticstack.domain.ServerStatus; -import org.jclouds.elasticstack.domain.VNC; - -import com.google.common.base.Function; -import com.google.common.base.Splitter; -import com.google.common.collect.Maps; -import org.jclouds.rest.annotations.ApiVersion; - /** * @author Adrian Cole */ @Singleton public class MapToServerInfo implements Function, ServerInfo> { - private String apiVersion; private final Function, Map> mapToDevices; private final Function, ServerMetrics> mapToMetrics; private final Function, List> mapToNICs; @@ -51,7 +42,6 @@ public class MapToServerInfo implements Function, ServerInfo @Inject public MapToServerInfo(Function, Map> mapToDevices, Function, ServerMetrics> mapToMetrics, Function, List> mapToNICs) { - this.apiVersion = apiVersion; this.mapToDevices = mapToDevices; this.mapToMetrics = mapToMetrics; this.mapToNICs = mapToNICs; diff --git a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/functions/MapToServerInfoTest.java b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/functions/MapToServerInfoTest.java index cdff044576..2324f26dec 100644 --- a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/functions/MapToServerInfoTest.java +++ b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/functions/MapToServerInfoTest.java @@ -104,6 +104,11 @@ public class MapToServerInfoTest { private static final MapToServerInfo MAP_TO_DRIVE = new MapToServerInfo(new MapToDevices(new DeviceToId()), new MapToServerMetrics(new MapToDriveMetrics()), new MapToNICs("1.0")); + + private static final MapToServerInfo MAP_TO_DRIVE_2_0 = new MapToServerInfo(new MapToDevices(new DeviceToId()), + new MapToServerMetrics(new MapToDriveMetrics()), new MapToNICs("2.0")); + + public void testEmptyMapReturnsNull() { assertEquals(MAP_TO_DRIVE.apply(ImmutableMap. of()), null); } @@ -137,6 +142,7 @@ public class MapToServerInfoTest { .name("adriancole.test") .vnc(new VNC("83.222.249.221", "XXXXXXXX", false)) .nics(ImmutableSet.of(new NIC.Builder() + .dhcp("auto") .model(Model.E1000) .block( ImmutableList.of("tcp/43594", "tcp/5902", "udp/5060", "tcp/5900", "tcp/5901", "tcp/21", "tcp/22", @@ -159,13 +165,12 @@ public class MapToServerInfoTest { } - public void testNew2() throws IOException { Map input = new ListOfKeyValuesDelimitedByBlankLinesToListOfMaps().apply( Strings2.toStringAndClose(MapToServerInfoTest.class.getResourceAsStream("/new_server2.txt"))).get(0); - assertEquals(MAP_TO_DRIVE.apply(input), NEW); + assertEquals(MAP_TO_DRIVE_2_0.apply(input), NEW); } } \ No newline at end of file From c8f4cad395d99cc23cb4410c1ca1443e2719f3af Mon Sep 17 00:00:00 2001 From: Mattias Holmqvist Date: Sun, 11 Sep 2011 22:39:20 +0200 Subject: [PATCH 2/5] Organized imports --- .../functions/ServerInfoToNodeMetadata.java | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java index 75429acbe2..eea5cc077b 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/functions/ServerInfoToNodeMetadata.java @@ -18,40 +18,27 @@ */ package org.jclouds.elasticstack.compute.functions; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.collect.FindResourceInSet; -import org.jclouds.collect.Memoized; -import org.jclouds.compute.domain.HardwareBuilder; -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.compute.domain.NodeMetadataBuilder; -import org.jclouds.compute.domain.NodeState; -import org.jclouds.compute.domain.Processor; -import org.jclouds.compute.domain.Volume; -import org.jclouds.compute.domain.VolumeBuilder; -import org.jclouds.domain.Credentials; -import org.jclouds.domain.Location; -import org.jclouds.elasticstack.domain.Device; -import org.jclouds.elasticstack.domain.DriveInfo; -import org.jclouds.elasticstack.domain.Server; -import org.jclouds.elasticstack.domain.ServerInfo; -import org.jclouds.elasticstack.domain.ServerStatus; - import com.google.common.base.Function; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import org.jclouds.collect.FindResourceInSet; +import org.jclouds.collect.Memoized; +import org.jclouds.compute.domain.*; +import org.jclouds.domain.Credentials; +import org.jclouds.domain.Location; +import org.jclouds.elasticstack.domain.*; + +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName; /** * @author Adrian Cole From 0c91e3ae3702c8615171d8330c7815c719e36eca Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 12 Sep 2011 18:54:58 -0700 Subject: [PATCH 3/5] Issue 669: fixed test properties for elasticstack 2.0 providers --- providers/elastichosts-lon-b/pom.xml | 2 +- providers/elastichosts-lon-p/pom.xml | 2 +- .../elastichosts/ElasticHostsPeer1LondonPropertiesBuilder.java | 2 +- providers/elastichosts-sat-p/pom.xml | 2 +- .../ElasticHostsPeer1SanAntonioPropertiesBuilder.java | 2 +- sandbox-providers/go2cloud-jhb1/pom.xml | 2 +- .../go2cloud/Go2CloudJohannesburg1PropertiesBuilder.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/providers/elastichosts-lon-b/pom.xml b/providers/elastichosts-lon-b/pom.xml index b8f71e3157..5a846040d0 100644 --- a/providers/elastichosts-lon-b/pom.xml +++ b/providers/elastichosts-lon-b/pom.xml @@ -35,7 +35,7 @@ https://api.lon-b.elastichosts.com - 1.0 + 2.0 FIXME_IDENTITY FIXME_CREDENTIAL diff --git a/providers/elastichosts-lon-p/pom.xml b/providers/elastichosts-lon-p/pom.xml index aac00aa93a..0ee84a1683 100644 --- a/providers/elastichosts-lon-p/pom.xml +++ b/providers/elastichosts-lon-p/pom.xml @@ -35,7 +35,7 @@ https://api.lon-p.elastichosts.com - 1.0 + 2.0 FIXME_IDENTITY FIXME_CREDENTIAL diff --git a/providers/elastichosts-lon-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1LondonPropertiesBuilder.java b/providers/elastichosts-lon-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1LondonPropertiesBuilder.java index 822f16934e..7bd46cd68c 100644 --- a/providers/elastichosts-lon-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1LondonPropertiesBuilder.java +++ b/providers/elastichosts-lon-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1LondonPropertiesBuilder.java @@ -37,7 +37,7 @@ public class ElasticHostsPeer1LondonPropertiesBuilder extends ElasticStackProper Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_ISO3166_CODES, "GB-LND"); properties.setProperty(PROPERTY_ENDPOINT, "https://api.lon-p.elastichosts.com"); - properties.setProperty(PROPERTY_API_VERSION, "1.0"); + properties.setProperty(PROPERTY_API_VERSION, "2.0"); return properties; } diff --git a/providers/elastichosts-sat-p/pom.xml b/providers/elastichosts-sat-p/pom.xml index 581590dd83..924651bb44 100644 --- a/providers/elastichosts-sat-p/pom.xml +++ b/providers/elastichosts-sat-p/pom.xml @@ -35,7 +35,7 @@ https://api.sat-p.elastichosts.com - 1.0 + 2.0 FIXME_IDENTITY FIXME_CREDENTIAL diff --git a/providers/elastichosts-sat-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1SanAntonioPropertiesBuilder.java b/providers/elastichosts-sat-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1SanAntonioPropertiesBuilder.java index 46e5fab378..b6e2ad94e9 100644 --- a/providers/elastichosts-sat-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1SanAntonioPropertiesBuilder.java +++ b/providers/elastichosts-sat-p/src/main/java/org/jclouds/elastichosts/ElasticHostsPeer1SanAntonioPropertiesBuilder.java @@ -37,7 +37,7 @@ public class ElasticHostsPeer1SanAntonioPropertiesBuilder extends ElasticStackPr Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_ISO3166_CODES, "US-TX"); properties.setProperty(PROPERTY_ENDPOINT, "https://api.sat-p.elastichosts.com"); - properties.setProperty(PROPERTY_API_VERSION, "1.0"); + properties.setProperty(PROPERTY_API_VERSION, "2.0"); return properties; } diff --git a/sandbox-providers/go2cloud-jhb1/pom.xml b/sandbox-providers/go2cloud-jhb1/pom.xml index 4e9a1e4427..efb3fa87d0 100644 --- a/sandbox-providers/go2cloud-jhb1/pom.xml +++ b/sandbox-providers/go2cloud-jhb1/pom.xml @@ -35,7 +35,7 @@ http://api.jhb1.go2cloud.co.za - 1.0 + 2.0 FIXME_IDENTITY FIXME_CREDENTIAL diff --git a/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/Go2CloudJohannesburg1PropertiesBuilder.java b/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/Go2CloudJohannesburg1PropertiesBuilder.java index 14b761ece1..505d431393 100644 --- a/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/Go2CloudJohannesburg1PropertiesBuilder.java +++ b/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/Go2CloudJohannesburg1PropertiesBuilder.java @@ -37,7 +37,7 @@ public class Go2CloudJohannesburg1PropertiesBuilder extends ElasticStackProperti Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_ISO3166_CODES, "ZA-GP"); properties.setProperty(PROPERTY_ENDPOINT, "http://api.jhb1.go2cloud.co.za"); - properties.setProperty(PROPERTY_API_VERSION, "1.0"); + properties.setProperty(PROPERTY_API_VERSION, "2.0"); return properties; } From 508372bbfaa8a728eff1238ba858e71f81b57435 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 12 Sep 2011 21:56:31 -0700 Subject: [PATCH 4/5] added content test for softlayer --- .../jclouds/softlayer/domain/Datacenter.java | 29 +++++++++++++++++++ .../features/DatacenterAsyncClient.java | 1 + .../features/DatacenterAsyncClientTest.java | 4 +-- .../features/DatacenterClientLiveTest.java | 27 +++++++++++++++-- 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/Datacenter.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/Datacenter.java index be58688ac3..8a07a17848 100644 --- a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/Datacenter.java +++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/Datacenter.java @@ -102,4 +102,33 @@ public class Datacenter implements Comparable { public Builder toBuilder() { return Builder.fromDatacenter(this); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) (id ^ (id >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Datacenter other = (Datacenter) obj; + if (id != other.id) + return false; + return true; + } + + @Override + public String toString() { + return "[id=" + id + ", name=" + name + ", longName=" + longName + "]"; + } + + } diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java index 37efa6a48f..5614bc98da 100644 --- a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java +++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/features/DatacenterAsyncClient.java @@ -53,6 +53,7 @@ public interface DatacenterAsyncClient { */ @GET @Path("/SoftLayer_Location_Datacenter/Datacenters.json") + @QueryParams(keys = "objectMask", values = "locationAddress") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) ListenableFuture> listDatacenters(); diff --git a/sandbox-providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java b/sandbox-providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java index cc34b77445..d5398d0425 100644 --- a/sandbox-providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java +++ b/sandbox-providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterAsyncClientTest.java @@ -44,7 +44,7 @@ public class DatacenterAsyncClientTest extends BaseSoftLayerAsyncClientTest response = client.listDatacenters(); assert null != response; assertTrue(response.size() >= 0); for (Datacenter vg : response) { Datacenter newDetails = client.getDatacenter(vg.getId()); assertEquals(vg.getId(), newDetails.getId()); - checkDatacenter(vg); + checkDatacenter(newDetails); } } @@ -60,4 +63,24 @@ public class DatacenterClientLiveTest extends BaseSoftLayerClientLiveTest { assert vg.getLongName() != null : vg; } + @Test + public void testListDatacentersContent() { + Builder expected = ImmutableSet. builder(); + expected.add(Datacenter.builder().id(3).name("dal01").longName("Dallas").build()); + expected.add(Datacenter.builder().id(18171).name("sea01").longName("Seattle").build()); + expected.add(Datacenter.builder().id(168642).name("sjc01").longName("San Jose 1").build()); + expected.add(Datacenter.builder().id(2).name("dal00").longName("Corporate HQ").build()); + expected.add(Datacenter.builder().id(37473).name("wdc01").longName("Washington, DC").build()); + expected.add(Datacenter.builder().id(154770).name("dal02").longName("Dallas 2").build()); + expected.add(Datacenter.builder().id(138124).name("dal05").longName("Dallas 5").build()); + expected.add(Datacenter.builder().id(167093).name("hou01").longName("Houston 1").build()); + expected.add(Datacenter.builder().id(167094).name("lon01").longName("London 1").build()); + expected.add(Datacenter.builder().id(167092).name("dal04").longName("Dallas 4").build()); + expected.add(Datacenter.builder().id(224092).name("sng01").longName("Singapore 1").build()); + expected.add(Datacenter.builder().id(142775).name("hou02").longName("Houston 2").build()); + expected.add(Datacenter.builder().id(142776).name("dal07").longName("Dallas 7").build()); + expected.add(Datacenter.builder().id(154820).name("dal06").longName("Dallas 6").build()); + Set response = client.listDatacenters(); + assertEquals(response.toString(), expected.build().toString()); + } } From 3b3c6eeac305bd4e6adb4468c1fc466bf912f6aa Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 12 Sep 2011 23:00:20 -0700 Subject: [PATCH 5/5] Issue 645: updated image list for go2cloud --- ...2CloudJohannesburg1ComputeServiceContextModule.java | 9 +++++++++ .../resources/go2cloud-jhb1/preinstalled_images.json | 10 +++++----- .../Go2CloudJohannesburg1TemplateBuilderLiveTest.java | 8 ++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/config/Go2CloudJohannesburg1ComputeServiceContextModule.java b/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/config/Go2CloudJohannesburg1ComputeServiceContextModule.java index 4cd4c2b422..792d669e59 100644 --- a/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/config/Go2CloudJohannesburg1ComputeServiceContextModule.java +++ b/sandbox-providers/go2cloud-jhb1/src/main/java/org/jclouds/go2cloud/config/Go2CloudJohannesburg1ComputeServiceContextModule.java @@ -18,12 +18,21 @@ */ package org.jclouds.go2cloud.config; +import static org.jclouds.compute.domain.OsFamily.DEBIAN; + +import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule; +import com.google.inject.Injector; + /** * * @author Adrian Cole */ public class Go2CloudJohannesburg1ComputeServiceContextModule extends ElasticStackComputeServiceContextModule { + @Override + protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { + return template.osFamily(DEBIAN).osVersionMatches("6.0").os64Bit(true); + } } diff --git a/sandbox-providers/go2cloud-jhb1/src/main/resources/go2cloud-jhb1/preinstalled_images.json b/sandbox-providers/go2cloud-jhb1/src/main/resources/go2cloud-jhb1/preinstalled_images.json index 8ac6adf3b9..cc87604c50 100644 --- a/sandbox-providers/go2cloud-jhb1/src/main/resources/go2cloud-jhb1/preinstalled_images.json +++ b/sandbox-providers/go2cloud-jhb1/src/main/resources/go2cloud-jhb1/preinstalled_images.json @@ -1,13 +1,13 @@ [ { - "uuid": "5192adbd-046f-4a48-90f9-3db390b1efab", - "description": "Ubuntu 11.04 Server 64 Bit", - "osFamily": "UBUNTU", - "osVersion": "11.04", + "uuid": "cc54132d-4912-4106-a91a-7a27e6866c8b", + "description": "Debian 6.0.2.1", + "osFamily": "DEBIAN", + "osVersion": "6.0", "size": "1" }, { - "uuid": "757f1074-82bd-453c-8cc1-70c4e697e5fe", + "uuid": "46e305b6-6a49-409c-bd12-eb966cdb3664", "description": "Windows 2008 R2 with SP1 (x64)", "osFamily": "WINDOWS", "osVersion": "2008 R2", diff --git a/sandbox-providers/go2cloud-jhb1/src/test/java/org/jclouds/go2cloud/compute/Go2CloudJohannesburg1TemplateBuilderLiveTest.java b/sandbox-providers/go2cloud-jhb1/src/test/java/org/jclouds/go2cloud/compute/Go2CloudJohannesburg1TemplateBuilderLiveTest.java index bc5832d4e8..a66c219954 100644 --- a/sandbox-providers/go2cloud-jhb1/src/test/java/org/jclouds/go2cloud/compute/Go2CloudJohannesburg1TemplateBuilderLiveTest.java +++ b/sandbox-providers/go2cloud-jhb1/src/test/java/org/jclouds/go2cloud/compute/Go2CloudJohannesburg1TemplateBuilderLiveTest.java @@ -52,8 +52,8 @@ public class Go2CloudJohannesburg1TemplateBuilderLiveTest extends BaseTemplateBu @Override public boolean apply(OsFamilyVersion64Bit input) { switch (input.family) { - case UBUNTU: - return (input.version.equals("") || input.version.equals("11.04")) && input.is64Bit; + case DEBIAN: + return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit; case WINDOWS: return (input.version.equals("") || input.version.equals("2008 R2")) && input.is64Bit; default: @@ -68,8 +68,8 @@ public class Go2CloudJohannesburg1TemplateBuilderLiveTest extends BaseTemplateBu public void testDefaultTemplateBuilder() throws IOException { Template defaultTemplate = this.context.getComputeService().templateBuilder().build(); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.04"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "6.0"); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.DEBIAN); assertEquals(defaultTemplate.getLocation().getId(), "go2cloud-jhb1"); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); }