diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClient.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClient.java index 885fa45cad..56f2e3bb0d 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClient.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClient.java @@ -96,6 +96,7 @@ import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler; */ @RequestFilters(SetVCloudTokenCookie.class) public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient { + /** * @see TerremarkVCloudClient#getDefaultVDC */ diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClient.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClient.java index ade50d6d9e..8e8bc4fa8a 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClient.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClient.java @@ -74,15 +74,18 @@ public class TerremarkVCloudComputeClient { Image.CENTOS_53, "6").put(Image.RHEL_53, "8").put(Image.UMBUNTU_90, "10").put( Image.UMBUNTU_JEOS, "11").build(); - public String start(String name, Image image, int minCores, int minMegs, Map properties) { + public String start(String name, Image image, int minCores, int minMegs, + Map properties) { checkArgument(imageCatalogIdMap.containsKey(image), "image not configured: " + image); String templateId = imageCatalogIdMap.get(image); String vDCId = tmClient.getDefaultVDC().getId(); - logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) minCores(%d) minMegs(%d) properties(%s)",vDCId, templateId, - name, minCores, minMegs, properties); + logger + .debug( + ">> instantiating vApp vDC(%s) template(%s) name(%s) minCores(%d) minMegs(%d) properties(%s)", + vDCId, templateId, name, minCores, minMegs, properties); TerremarkVApp vApp = tmClient.instantiateVAppTemplateInVDC(vDCId, name, templateId, - TerremarkInstantiateVAppTemplateOptions.Builder.processorCount(minCores) - .memory(minMegs).productProperties(properties)); + TerremarkInstantiateVAppTemplateOptions.Builder.processorCount(minCores).memory( + minMegs).productProperties(properties)); logger.debug("<< instantiated VApp(%s)", vApp.getId()); logger.debug(">> deploying vApp(%s)", vApp.getId()); @@ -125,32 +128,37 @@ public class TerremarkVCloudComputeClient { switch (port) { case 22: protocol = Protocol.TCP; + break; case 80: case 8080: protocol = Protocol.HTTP; + break; case 443: protocol = Protocol.HTTPS; + break; default: protocol = Protocol.HTTP; - + break; } if (ip == null) { - logger.debug(">> creating InternetService in vDC %s; port %d", vApp.getVDC().getId(), - port); + logger.debug(">> creating InternetService in vDC %s:%s:%d", vApp.getVDC().getId(), + protocol, port); is = tmClient.addInternetServiceToVDC(vApp.getVDC().getId(), vApp.getName() + "-" + port, protocol, port, withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getId(), vApp.getName()))); ip = is.getPublicIpAddress(); } else { - logger.debug(">> adding InternetService %s:%d", ip.getAddress().getHostAddress(), port); + logger.debug(">> adding InternetService %s:%s:%d", ip.getAddress().getHostAddress(), + protocol, port); is = tmClient.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port, withDescription(String.format( "port %d access to serverId: %s name: %s", port, vApp.getId(), vApp .getName()))); } - logger.debug("<< created InternetService(%s) %s:%d", is.getId(), is.getPublicIpAddress() - .getAddress().getHostAddress(), is.getPort()); + logger.debug("<< created InternetService(%s) %s:%s:%d", is.getId(), is + .getPublicIpAddress().getAddress().getHostAddress(), is.getProtocol(), is + .getPort()); logger.debug(">> adding Node %s:%d -> %s:%d", is.getPublicIpAddress().getAddress() .getHostAddress(), is.getPort(), privateAddress.getHostAddress(), port); Node node = tmClient diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeService.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeService.java index 9ee506cc9d..6b4ce97025 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeService.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeService.java @@ -85,7 +85,7 @@ public class TerremarkVCloudComputeService implements ComputeService { public CreateServerResponse createServer(String name, Profile profile, Image image) { String id = computeClient.start(name, image, 1, 512, ImmutableMap. of()); TerremarkVApp vApp = tmClient.getVApp(id); - InetAddress publicIp = computeClient.createPublicAddressMappedToPorts(vApp, 22, 80, 443, 8080); + InetAddress publicIp = computeClient.createPublicAddressMappedToPorts(vApp, 22); return new CreateServerResponseImpl(vApp.getId(), vApp.getName(), vAppStatusToServerState .get(vApp.getStatus()), ImmutableSet. of(publicIp), vApp .getNetworkToAddresses().values(), 22, LoginType.SSH, new Credentials("vcloud", diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientLiveTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientLiveTest.java index 3aeee5a5d3..e690aac467 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientLiveTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/compute/TerremarkVCloudComputeClientLiveTest.java @@ -120,8 +120,10 @@ public class TerremarkVCloudComputeClientLiveTest { @Test(dependsOnMethods = "testGetAnyPrivateAddress") public void testSshLoadBalanceIp() { - InetAddress publicIp = client.createPublicAddressMappedToPorts(tmClient.getVApp(id), 22, 80, - 8080); + // InetAddress publicIp = client.createPublicAddressMappedToPorts(tmClient.getVApp(id), 22, + // 80, + // 443, 8080); /// error 500 + InetAddress publicIp = client.createPublicAddressMappedToPorts(tmClient.getVApp(id), 22); assert addressTester.apply(publicIp); // client.exec(publicIp, "uname -a"); }