diff --git a/allcompute/pom.xml b/allcompute/pom.xml index 6b3c6e66ec..a84113f858 100644 --- a/allcompute/pom.xml +++ b/allcompute/pom.xml @@ -29,6 +29,11 @@ jclouds-allcompute allcompute + + org.jclouds.provider + aws-ec2 + ${project.version} + org.jclouds.api ec2 diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2PropertiesBuilder.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2PropertiesBuilder.java index e3241f916c..21433ebd5f 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2PropertiesBuilder.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2PropertiesBuilder.java @@ -23,10 +23,8 @@ import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG; -import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_SUSPENDED; import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_CC_AMIs; -import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_ELB_ENDPOINT; import java.util.Properties; @@ -45,20 +43,8 @@ public class EC2PropertiesBuilder extends PropertiesBuilder { properties.setProperty(PROPERTY_HEADER_TAG, "amz"); properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com"); properties.setProperty(PROPERTY_API_VERSION, EC2AsyncClient.VERSION); - properties.setProperty(PROPERTY_ELB_ENDPOINT, "https://elasticloadbalancing.us-east-1.amazonaws.com"); - // amazon, alestic, canonical, and rightscale - properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317"); - // amis that work with the cluster instances - properties.setProperty(PROPERTY_EC2_CC_AMIs, "us-east-1/ami-7ea24a17"); - // sometimes, like in ec2, stop takes a very long time, perhaps - // due to volume management. one example spent 2 minutes moving - // from stopping->stopped state on an ec2 micro - properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + ""); - // auth fail sometimes happens in EC2, as the rc.local script that injects the - // authorized key executes after ssh has started - properties.setProperty("jclouds.ssh.max_retries", "7"); - properties.setProperty("jclouds.ssh.retryable_messages", - "Auth fail,invalid data,End of IO Stream Read,Connection reset,socket is not established"); + properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*"); + properties.setProperty(PROPERTY_EC2_CC_AMIs, ""); return properties; } diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/services/BaseEC2AsyncClientTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/services/BaseEC2AsyncClientTest.java index 8fc9eb59f4..f9eff08931 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/services/BaseEC2AsyncClientTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/services/BaseEC2AsyncClientTest.java @@ -106,9 +106,11 @@ public abstract class BaseEC2AsyncClientTest extends RestClientTest { return new StubEC2RestClientModule(); } + protected String provider = "ec2"; + @Override public RestContextSpec createContextSpec() { - return new RestContextFactory().createContextSpec("ec2", "identity", "credential", new Properties()); + return new RestContextFactory().createContextSpec(provider, "identity", "credential", new Properties()); } } diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index 24ec2ecec7..4038204bb3 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -60,7 +60,7 @@ ec2.contextbuilder=org.jclouds.ec2.EC2ContextBuilder ec2.propertiesbuilder=org.jclouds.ec2.EC2PropertiesBuilder aws-ec2.contextbuilder=org.jclouds.ec2.EC2ContextBuilder -aws-ec2.propertiesbuilder=org.jclouds.ec2.EC2PropertiesBuilder +aws-ec2.propertiesbuilder=org.jclouds.aws.ec2.AWSEC2PropertiesBuilder rimuhosting.contextbuilder=org.jclouds.rimuhosting.miro.RimuHostingContextBuilder rimuhosting.propertiesbuilder=org.jclouds.rimuhosting.miro.RimuHostingPropertiesBuilder diff --git a/providers/aws-ec2/pom.xml b/providers/aws-ec2/pom.xml new file mode 100644 index 0000000000..05bbcb5d15 --- /dev/null +++ b/providers/aws-ec2/pom.xml @@ -0,0 +1,136 @@ + + + + + 4.0.0 + + org.jclouds.provider + jclouds-providers-project + 1.0-SNAPSHOT + ../pom.xml + + aws-ec2 + jclouds Amazon EC2 provider + EC2 implementation targeted to Amazon Web Services + + + https://ec2.us-east-1.amazonaws.com + 2010-06-15 + ${test.aws.identity} + ${test.aws.credential} + + + + + org.jclouds.api + ec2 + ${project.version} + jar + + + org.jclouds.api + ec2 + ${project.version} + test-jar + test + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds + jclouds-compute + ${project.version} + test-jar + test + + + org.jclouds + jclouds-log4j + ${project.version} + test + + + org.jclouds + jclouds-jsch + ${project.version} + test + + + log4j + log4j + 1.2.16 + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + + test.aws-ec2.endpoint + ${test.aws-ec2.endpoint} + + + test.aws-ec2.apiversion + ${test.aws-ec2.apiversion} + + + test.aws-ec2.identity + ${test.aws-ec2.identity} + + + test.aws-ec2.credential + ${test.aws-ec2.credential} + + + + + + + + + + + + + + diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2PropertiesBuilder.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2PropertiesBuilder.java new file mode 100644 index 0000000000..5a76413779 --- /dev/null +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2PropertiesBuilder.java @@ -0,0 +1,73 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.ec2; + +import static org.jclouds.aws.domain.Region.AP_SOUTHEAST_1; +import static org.jclouds.aws.domain.Region.EU_WEST_1; +import static org.jclouds.aws.domain.Region.US_EAST_1; +import static org.jclouds.aws.domain.Region.US_WEST_1; +import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_SUSPENDED; +import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; +import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_CC_AMIs; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; + +import java.util.Properties; +import java.util.Set; + +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableSet; + +/** + * Builds properties used in EC2 Clients + * + * @author Adrian Cole + */ +public class AWSEC2PropertiesBuilder extends org.jclouds.ec2.EC2PropertiesBuilder { + public static Set DEFAULT_REGIONS = ImmutableSet.of(EU_WEST_1, US_EAST_1, US_WEST_1, AP_SOUTHEAST_1); + + @Override + protected Properties defaultProperties() { + Properties properties = super.defaultProperties(); + // sometimes, like in ec2, stop takes a very long time, perhaps + // due to volume management. one example spent 2 minutes moving + // from stopping->stopped state on an ec2 micro + properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + ""); + // auth fail sometimes happens in EC2, as the rc.local script that injects the + // authorized key executes after ssh has started + properties.setProperty("jclouds.ssh.max_retries", "7"); + properties.setProperty("jclouds.ssh.retryable_messages", + "Auth fail,invalid data,End of IO Stream Read,Connection reset,socket is not established"); + properties.setProperty(PROPERTY_REGIONS, Joiner.on(',').join(DEFAULT_REGIONS)); + // amazon, alestic, canonical, and rightscale + properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "137112412989,063491364108,099720109477,411009282317"); + // amis that work with the cluster instances + properties.setProperty(PROPERTY_EC2_CC_AMIs, "us-east-1/ami-7ea24a17"); + return properties; + } + + public AWSEC2PropertiesBuilder() { + super(); + } + + public AWSEC2PropertiesBuilder(Properties properties) { + super(properties); + } + +} diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java new file mode 100644 index 0000000000..bf214e6507 --- /dev/null +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java @@ -0,0 +1,37 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.ec2.compute; + +import org.jclouds.ec2.compute.EC2ComputeServiceLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", sequential = true, testName = "AWSEC2ComputeServiceLiveTest") +public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest { + + public AWSEC2ComputeServiceLiveTest() { + provider = "aws-ec2"; + tag = "ec2"; + } + +} diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java similarity index 97% rename from apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderLiveTest.java rename to providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java index bd0a039a1b..28bcf8a203 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2TemplateBuilderLiveTest.java @@ -17,7 +17,7 @@ * ==================================================================== */ -package org.jclouds.ec2.compute; +package org.jclouds.aws.ec2.compute; import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.testng.Assert.assertEquals; @@ -25,14 +25,14 @@ import static org.testng.Assert.assertEquals; import java.io.IOException; import java.util.Properties; -import org.jclouds.ec2.domain.InstanceType; -import org.jclouds.ec2.reference.EC2Constants; import org.jclouds.compute.BaseTemplateBuilderLiveTest; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.os.OsFamilyVersion64Bit; +import org.jclouds.ec2.domain.InstanceType; +import org.jclouds.ec2.reference.EC2Constants; import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.testng.annotations.Test; @@ -45,10 +45,10 @@ import com.google.inject.Module; * @author Adrian Cole */ @Test(groups = "live") -public class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { +public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { - public EC2TemplateBuilderLiveTest() { - provider = "ec2"; + public AWSEC2TemplateBuilderLiveTest() { + provider = "aws-ec2"; } @Override diff --git a/providers/pom.xml b/providers/pom.xml index 0611b2faaa..c8d7244771 100644 --- a/providers/pom.xml +++ b/providers/pom.xml @@ -39,6 +39,7 @@ aws-simpledb aws-elb aws-s3 + aws-ec2 googlestorage scaleup-storage ecc-s3