Rackspace Cloud Block Storage providers for the OpenStack Cinder API.

This commit is contained in:
Everett Toews 2012-11-08 16:08:00 -06:00
parent 3aa47bb499
commit 5cb1f2e426
18 changed files with 1138 additions and 5 deletions

View File

@ -40,7 +40,7 @@ import com.google.common.collect.Iterables;
/**
* Tests behavior of VolumeApi
*
*
* @author Everett Toews
*/
@Test(groups = "live", testName = "VolumeApiLiveTest", singleThreaded = true)
@ -74,7 +74,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
public boolean apply(SnapshotApi snapshotApi) {
return snapshotApi.get(testSnapshot.getId()) == null;
}
}, 30 * 1000L).apply(snapshotApi));
}, 300 * 1000L).apply(snapshotApi));
}
if (testVolume != null) {
@ -84,7 +84,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
public boolean apply(VolumeApi volumeApi) {
return volumeApi.get(testVolume.getId()) == null;
}
}, 30 * 1000L).apply(volumeApi));
}, 300 * 1000L).apply(volumeApi));
}
super.tearDownContext();

View File

@ -43,10 +43,8 @@
<module>openstack-swift</module>
<module>jenkins</module>
<module>cdmi</module>
<module>openstack-glance</module>
<module>joyent-cloudapi</module>
<module>joyentcloud</module>
<module>openstack-quantum</module>
<module>greenqloud-compute</module>
<module>greenqloud-storage</module>
<module>iam</module>
@ -62,6 +60,10 @@
<module>fgcp-de</module>
<module>abiquo</module>
<module>oauth</module>
<module>openstack-quantum</module>
<module>openstack-glance</module>
<module>openstack-cinder</module>
<module>rackspace-cloudblockstorage-us</module>
<module>rackspace-cloudblockstorage-uk</module>
</modules>
</project>

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to jclouds, Inc. (jclouds) under one or more
contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. jclouds licenses this file
to you 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.6.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.labs</groupId>
<artifactId>rackspace-cloudblockstorage-uk</artifactId>
<name>jclouds Rackspace Next Generation Cloud Block Storage UK provider</name>
<description>OpenStack Cinder implementation targeted to Rackspace Next Generation Cloud Block Storage UK</description>
<packaging>bundle</packaging>
<properties>
<test.rackspace-cloudblockstorage-uk.endpoint>https://lon.identity.api.rackspacecloud.com/v2.0/</test.rackspace-cloudblockstorage-uk.endpoint>
<test.rackspace-cloudblockstorage-uk.api-version>1</test.rackspace-cloudblockstorage-uk.api-version>
<test.rackspace-cloudblockstorage-uk.build-version></test.rackspace-cloudblockstorage-uk.build-version>
<test.rackspace-cloudblockstorage-uk.identity>${test.rackspace-uk.identity}</test.rackspace-cloudblockstorage-uk.identity>
<test.rackspace-cloudblockstorage-uk.credential>${test.rackspace-uk.credential}</test.rackspace-cloudblockstorage-uk.credential>
<test.rackspace-cloudblockstorage-uk.template></test.rackspace-cloudblockstorage-uk.template>
<jclouds.osgi.export>org.jclouds.rackspace.cloudblockstorage.uk*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
org.jclouds.rest.internal;version="${project.version}",
org.jclouds*;version="${project.version}",
*
</jclouds.osgi.import>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.labs</groupId>
<artifactId>openstack-cinder</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>rackspace-cloudidentity</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.labs</groupId>
<artifactId>openstack-cinder</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>rackspace-cloudidentity</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<threadCount>1</threadCount>
<systemPropertyVariables>
<test.rackspace-cloudblockstorage-uk.endpoint>${test.rackspace-cloudblockstorage-uk.endpoint}</test.rackspace-cloudblockstorage-uk.endpoint>
<test.rackspace-cloudblockstorage-uk.api-version>${test.rackspace-cloudblockstorage-uk.api-version}</test.rackspace-cloudblockstorage-uk.api-version>
<test.rackspace-cloudblockstorage-uk.build-version>${test.rackspace-cloudblockstorage-uk.build-version}</test.rackspace-cloudblockstorage-uk.build-version>
<test.rackspace-cloudblockstorage-uk.identity>${test.rackspace-cloudblockstorage-uk.identity}</test.rackspace-cloudblockstorage-uk.identity>
<test.rackspace-cloudblockstorage-uk.credential>${test.rackspace-cloudblockstorage-uk.credential}</test.rackspace-cloudblockstorage-uk.credential>
<test.rackspace-cloudblockstorage-uk.template>${test.rackspace-cloudblockstorage-uk.template}</test.rackspace-cloudblockstorage-uk.template>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,111 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.uk;
import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import java.net.URI;
import java.util.Properties;
import org.jclouds.openstack.cinder.v1.CinderApiMetadata;
import org.jclouds.openstack.cinder.v1.config.CinderParserModule;
import org.jclouds.openstack.cinder.v1.config.CinderRestClientModule;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Next Generation Cloud Block Storage.
*
* @author Everett Toews
*/
public class CloudBlockStorageUKProviderMetadata extends BaseProviderMetadata {
private static final long serialVersionUID = -620987914134012695L;
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return builder().fromProviderMetadata(this);
}
public CloudBlockStorageUKProviderMetadata() {
super(builder());
}
public CloudBlockStorageUKProviderMetadata(Builder builder) {
super(builder);
}
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS);
properties.setProperty(PROPERTY_ZONES, "LON");
properties.setProperty(PROPERTY_ZONE + ".LON." + ISO3166_CODES, "GB-SLG");
return properties;
}
public static class Builder extends BaseProviderMetadata.Builder {
protected Builder(){
id("rackspace-cloudblockstorage-uk")
.name("Rackspace Next Generation Cloud Block Storage UK")
.apiMetadata(new CinderApiMetadata().toBuilder()
.identityName("${userName}")
.credentialName("${apiKey}")
.defaultEndpoint("https://lon.identity.api.rackspacecloud.com/v2.0/")
.endpointName("identity service url ending in /v2.0/")
.documentation(URI.create("http://docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/overview.html"))
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationModule.class)
.add(ZoneModule.class)
.add(CinderParserModule.class)
.add(CinderRestClientModule.class).build())
.build())
.homepage(URI.create("http://www.rackspace.co.uk/cloud-hosting/cloud-products/cloud-block-storage/"))
.console(URI.create("https://mycloud.rackspace.co.uk"))
.linkedServices("rackspace-cloudservers-uk", "cloudfiles-uk")
.iso3166Codes("GB-SLG")
.endpoint("https://lon.identity.api.rackspacecloud.com/v2.0/")
.defaultProperties(CloudBlockStorageUKProviderMetadata.defaultProperties());
}
@Override
public CloudBlockStorageUKProviderMetadata build() {
return new CloudBlockStorageUKProviderMetadata(this);
}
@Override
public Builder fromProviderMetadata(ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}
}
}

View File

@ -0,0 +1 @@
org.jclouds.rackspace.cloudblockstorage.uk.CloudBlockStorageUKProviderMetadata

View File

@ -0,0 +1,67 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.uk;
import static org.testng.Assert.assertEquals;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.cinder.v1.CinderApi;
import org.jclouds.openstack.cinder.v1.internal.BaseCinderApiExpectTest;
import org.jclouds.rackspace.cloudblockstorage.uk.CloudBlockStorageUKProviderMetadata;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* This test ensures that the wiring in {@link CloudBlockStorageUKProviderMetadata} is correct.
*
* @author Everett Toews
*/
@Test(groups = "unit", testName = "CloudBlockStorageUKProviderMetadataExpectTest")
public class CloudBlockStorageUKProviderMetadataExpectTest extends BaseCinderApiExpectTest {
public CloudBlockStorageUKProviderMetadataExpectTest() {
this.provider = "rackspace-cloudblockstorage-uk";
this.identity = "myUsername";
this.credential = "myApiKey";
}
public void testCanGetConfiguredZones() {
HttpRequest authenticate = HttpRequest.builder().method("POST")
.endpoint("https://lon.identity.api.rackspacecloud.com/v2.0/tokens")
.addHeader("Accept", "application/json")
.payload(payloadFromStringWithContentType(
"{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"myUsername\",\"apiKey\":\"myApiKey\"}}}"
, "application/json")).build();
HttpResponse authenticationResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/access_rax_uk.json", "application/json"))
.build();
CinderApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("LON"));
}
}

View File

@ -0,0 +1,35 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not computee 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.rackspace.cloudblockstorage.uk;
import org.jclouds.openstack.cinder.v1.CinderApiMetadata;
import org.jclouds.providers.internal.BaseProviderMetadataTest;
import org.jclouds.rackspace.cloudblockstorage.uk.CloudBlockStorageUKProviderMetadata;
import org.testng.annotations.Test;
/**
* @author Everett Toews
*/
@Test(groups = "unit", testName = "CloudBlockStorageUKProviderTest")
public class CloudBlockStorageUKProviderTest extends BaseProviderMetadataTest {
public CloudBlockStorageUKProviderTest() {
super(new CloudBlockStorageUKProviderMetadata(), new CinderApiMetadata());
}
}

View File

@ -0,0 +1,32 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.uk.features;
import org.jclouds.openstack.cinder.v1.features.VolumeAndSnapshotApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Everett Toews
*/
@Test(groups = "live", testName = "CloudBlockStorageUKVolumeAndSnapshotApiLiveTest")
public class CloudBlockStorageUKVolumeAndSnapshotApiLiveTest extends VolumeAndSnapshotApiLiveTest {
public CloudBlockStorageUKVolumeAndSnapshotApiLiveTest() {
provider = "rackspace-cloudblockstorage-uk";
}
}

View File

@ -0,0 +1,32 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.uk.features;
import org.jclouds.openstack.cinder.v1.features.VolumeTypeApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Everett Toews
*/
@Test(groups = "live", testName = "CloudBlockStorageUSVolumeTypeApiLiveTest")
public class CloudBlockStorageUKVolumeTypeApiLiveTest extends VolumeTypeApiLiveTest {
public CloudBlockStorageUKVolumeTypeApiLiveTest() {
provider = "rackspace-cloudblockstorage-uk";
}
}

View File

@ -0,0 +1,129 @@
{
"access": {
"token": {
"id": "bdd18214-e266-4ad3-b985-d9bfb22c8da8",
"expires": "2012-10-01T02:11:16.000+01:00",
"tenant": {
"id": "10001786",
"name": "10001786"
}
},
"serviceCatalog": [
{
"endpoints": [
{
"region": "LON",
"tenantId": "MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953",
"publicURL": "https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953",
"internalURL": "https://snet-storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953"
}
],
"name": "cloudFiles",
"type": "object-store"
},
{
"endpoints": [
{
"region": "LON",
"tenantId": "MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953",
"publicURL": "https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953"
}
],
"name": "cloudFilesCDN",
"type": "rax:object-cdn"
},
{
"endpoints": [
{
"tenantId": "10001786",
"publicURL": "https://lon.servers.api.rackspacecloud.com/v1.0/10001786",
"versionInfo": "https://lon.servers.api.rackspacecloud.com/v1.0",
"versionList": "https://lon.servers.api.rackspacecloud.com/",
"versionId": "1.0"
}
],
"name": "cloudServers",
"type": "compute"
},
{
"endpoints": [
{
"tenantId": "10001786",
"publicURL": "https://lon.dns.api.rackspacecloud.com/v1.0/10001786"
}
],
"name": "cloudDNS",
"type": "rax:dns"
},
{
"endpoints": [
{
"region": "LON",
"tenantId": "10001786",
"publicURL": "https://lon.loadbalancers.api.rackspacecloud.com/v1.0/10001786"
}
],
"name": "cloudLoadBalancers",
"type": "rax:load-balancer"
},
{
"endpoints": [
{
"tenantId": "10001786",
"publicURL": "https://monitoring.api.rackspacecloud.com/v1.0/10001786"
}
],
"name": "cloudMonitoring",
"type": "rax:monitor"
},
{
"endpoints": [
{
"region": "LON",
"tenantId": "10001786",
"publicURL": "https://lon.databases.api.rackspacecloud.com/v1.0/10001786"
}
],
"name": "cloudDatabases",
"type": "rax:database"
},
{
"endpoints": [
{
"region": "LON",
"tenantId": "10001786",
"publicURL": "https://lon.servers.api.rackspacecloud.com/v2/10001786",
"versionInfo": "https://lon.servers.api.rackspacecloud.com/v2",
"versionList": "https://lon.servers.api.rackspacecloud.com/",
"versionId": "2"
}
],
"name": "cloudServersOpenStack",
"type": "compute"
},
{
"endpoints": [
{
"publicURL": "https://lon.blockstorage.api.rackspacecloud.com/v1/10001786",
"tenantId": "10001786",
"region": "LON"
}
],
"name": "cloudBlockStorage",
"type": "volume"
}
],
"user": {
"id": "378",
"roles": [
{
"id": "3",
"description": "User Admin Role.",
"name": "identity:user-admin"
}
],
"name": "jclouds",
"RAX-AUTH:defaultRegion": ""
}
}
}

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to jclouds, Inc. (jclouds) under one or more
contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. jclouds licenses this file
to you 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.6.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.labs</groupId>
<artifactId>rackspace-cloudblockstorage-us</artifactId>
<name>jclouds Rackspace Next Generation Cloud Block Storage US provider</name>
<description>OpenStack Cinder implementation targeted to Rackspace Next Generation Cloud Block Storage US</description>
<packaging>bundle</packaging>
<properties>
<test.rackspace-cloudblockstorage-us.endpoint>https://identity.api.rackspacecloud.com/v2.0/</test.rackspace-cloudblockstorage-us.endpoint>
<test.rackspace-cloudblockstorage-us.api-version>1</test.rackspace-cloudblockstorage-us.api-version>
<test.rackspace-cloudblockstorage-us.build-version></test.rackspace-cloudblockstorage-us.build-version>
<test.rackspace-cloudblockstorage-us.identity>${test.rackspace-us.identity}</test.rackspace-cloudblockstorage-us.identity>
<test.rackspace-cloudblockstorage-us.credential>${test.rackspace-us.credential}</test.rackspace-cloudblockstorage-us.credential>
<test.rackspace-cloudblockstorage-us.template></test.rackspace-cloudblockstorage-us.template>
<jclouds.osgi.export>org.jclouds.rackspace.cloudblockstorage.us*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
org.jclouds.rest.internal;version="${project.version}",
org.jclouds*;version="${project.version}",
*
</jclouds.osgi.import>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.labs</groupId>
<artifactId>openstack-cinder</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>rackspace-cloudidentity</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.labs</groupId>
<artifactId>openstack-cinder</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>rackspace-cloudidentity</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<threadCount>1</threadCount>
<systemPropertyVariables>
<test.rackspace-cloudblockstorage-us.endpoint>${test.rackspace-cloudblockstorage-us.endpoint}</test.rackspace-cloudblockstorage-us.endpoint>
<test.rackspace-cloudblockstorage-us.api-version>${test.rackspace-cloudblockstorage-us.api-version}</test.rackspace-cloudblockstorage-us.api-version>
<test.rackspace-cloudblockstorage-us.build-version>${test.rackspace-cloudblockstorage-us.build-version}</test.rackspace-cloudblockstorage-us.build-version>
<test.rackspace-cloudblockstorage-us.identity>${test.rackspace-cloudblockstorage-us.identity}</test.rackspace-cloudblockstorage-us.identity>
<test.rackspace-cloudblockstorage-us.credential>${test.rackspace-cloudblockstorage-us.credential}</test.rackspace-cloudblockstorage-us.credential>
<test.rackspace-cloudblockstorage-us.template>${test.rackspace-cloudblockstorage-us.template}</test.rackspace-cloudblockstorage-us.template>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,112 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.us;
import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import java.net.URI;
import java.util.Properties;
import org.jclouds.openstack.cinder.v1.CinderApiMetadata;
import org.jclouds.openstack.cinder.v1.config.CinderParserModule;
import org.jclouds.openstack.cinder.v1.config.CinderRestClientModule;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Next Generation Cloud Block Storage.
*
* @author Everett Toews
*/
public class CloudBlockStorageUSProviderMetadata extends BaseProviderMetadata {
private static final long serialVersionUID = -290987074134012652L;
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return builder().fromProviderMetadata(this);
}
public CloudBlockStorageUSProviderMetadata() {
super(builder());
}
public CloudBlockStorageUSProviderMetadata(Builder builder) {
super(builder);
}
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS);
properties.setProperty(PROPERTY_ZONES, "ORD,DFW");
properties.setProperty(PROPERTY_ZONE + ".ORD." + ISO3166_CODES, "US-IL");
properties.setProperty(PROPERTY_ZONE + ".DFW." + ISO3166_CODES, "US-TX");
return properties;
}
public static class Builder extends BaseProviderMetadata.Builder {
protected Builder(){
id("rackspace-cloudblockstorage-us")
.name("Rackspace Next Generation Cloud Block Storage US")
.apiMetadata(new CinderApiMetadata().toBuilder()
.identityName("${userName}")
.credentialName("${apiKey}")
.defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/")
.endpointName("identity service url ending in /v2.0/")
.documentation(URI.create("http://docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/overview.html"))
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationModule.class)
.add(ZoneModule.class)
.add(CinderParserModule.class)
.add(CinderRestClientModule.class).build())
.build())
.homepage(URI.create("http://www.rackspace.com/cloud/public/blockstorage/"))
.console(URI.create("https://mycloud.rackspace.com"))
.linkedServices("rackspace-cloudservers-us", "cloudfiles-us")
.iso3166Codes("US-IL", "US-TX")
.endpoint("https://identity.api.rackspacecloud.com/v2.0/")
.defaultProperties(CloudBlockStorageUSProviderMetadata.defaultProperties());
}
@Override
public CloudBlockStorageUSProviderMetadata build() {
return new CloudBlockStorageUSProviderMetadata(this);
}
@Override
public Builder fromProviderMetadata(ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}
}
}

View File

@ -0,0 +1 @@
org.jclouds.rackspace.cloudblockstorage.us.CloudBlockStorageUSProviderMetadata

View File

@ -0,0 +1,66 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.us;
import static org.testng.Assert.assertEquals;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.cinder.v1.CinderApi;
import org.jclouds.openstack.cinder.v1.internal.BaseCinderApiExpectTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* This test ensures that the wiring in {@link CloudBlockStorageUSProviderMetadata} is correct.
*
* @author Everett Toews
*/
@Test(groups = "unit", testName = "CloudBlockStorageUSProviderMetadataExpectTest")
public class CloudBlockStorageUSProviderMetadataExpectTest extends BaseCinderApiExpectTest {
public CloudBlockStorageUSProviderMetadataExpectTest() {
this.provider = "rackspace-cloudblockstorage-us";
this.identity = "myUsername";
this.credential = "myApiKey";
}
public void testCanGetConfiguredZones() {
HttpRequest authenticate = HttpRequest.builder().method("POST")
.endpoint("https://identity.api.rackspacecloud.com/v2.0/tokens")
.addHeader("Accept", "application/json")
.payload(payloadFromStringWithContentType(
"{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"myUsername\",\"apiKey\":\"myApiKey\"}}}"
, "application/json")).build();
HttpResponse authenticationResponse = HttpResponse.builder()
.statusCode(200)
.payload(payloadFromResourceWithContentType("/access_rax_us.json", "application/json"))
.build();
CinderApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse);
assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("ORD", "DFW"));
}
}

View File

@ -0,0 +1,34 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not computee 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.rackspace.cloudblockstorage.us;
import org.jclouds.openstack.cinder.v1.CinderApiMetadata;
import org.jclouds.providers.internal.BaseProviderMetadataTest;
import org.testng.annotations.Test;
/**
* @author Everett Toews
*/
@Test(groups = "unit", testName = "CloudBlockStorageUSProviderTest")
public class CloudBlockStorageUSProviderTest extends BaseProviderMetadataTest {
public CloudBlockStorageUSProviderTest() {
super(new CloudBlockStorageUSProviderMetadata(), new CinderApiMetadata());
}
}

View File

@ -0,0 +1,32 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.us.features;
import org.jclouds.openstack.cinder.v1.features.VolumeAndSnapshotApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Everett Toews
*/
@Test(groups = "live", testName = "CloudBlockStorageUSVolumeAndSnapshotApiLiveTest")
public class CloudBlockStorageUSVolumeAndSnapshotApiLiveTest extends VolumeAndSnapshotApiLiveTest {
public CloudBlockStorageUSVolumeAndSnapshotApiLiveTest() {
provider = "rackspace-cloudblockstorage-us";
}
}

View File

@ -0,0 +1,32 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you 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.rackspace.cloudblockstorage.us.features;
import org.jclouds.openstack.cinder.v1.features.VolumeTypeApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Everett Toews
*/
@Test(groups = "live", testName = "CloudBlockStorageUSVolumeTypeApiLiveTest")
public class CloudBlockStorageUSVolumeTypeApiLiveTest extends VolumeTypeApiLiveTest {
public CloudBlockStorageUSVolumeTypeApiLiveTest() {
provider = "rackspace-cloudblockstorage-us";
}
}

View File

@ -0,0 +1,163 @@
{
"access": {
"token": {
"id": "myToken",
"expires": "2012-09-30T17:15:32.000-05:00",
"tenant": {
"id": "717071",
"name": "717071"
}
},
"serviceCatalog": [
{
"endpoints": [
{
"tenantId": "717071",
"publicURL": "https://dns.api.rackspacecloud.com/v1.0/717071"
}
],
"name": "cloudDNS",
"type": "rax:dns"
},
{
"endpoints": [
{
"tenantId": "717071",
"publicURL": "https://monitoring.api.rackspacecloud.com/v1.0/717071"
}
],
"name": "cloudMonitoring",
"type": "rax:monitor"
},
{
"endpoints": [
{
"region": "DFW",
"tenantId": "717071",
"publicURL": "https://dfw.servers.api.rackspacecloud.com/v2/717071",
"versionInfo": "https://dfw.servers.api.rackspacecloud.com/v2",
"versionList": "https://dfw.servers.api.rackspacecloud.com/",
"versionId": "2"
},
{
"region": "ORD",
"tenantId": "717071",
"publicURL": "https://ord.servers.api.rackspacecloud.com/v2/717071",
"versionInfo": "https://ord.servers.api.rackspacecloud.com/v2",
"versionList": "https://ord.servers.api.rackspacecloud.com/",
"versionId": "2"
}
],
"name": "cloudServersOpenStack",
"type": "compute"
},
{
"endpoints": [
{
"region": "ORD",
"tenantId": "717071",
"publicURL": "https://ord.loadbalancers.api.rackspacecloud.com/v1.0/717071"
},
{
"region": "DFW",
"tenantId": "717071",
"publicURL": "https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/717071"
}
],
"name": "cloudLoadBalancers",
"type": "rax:load-balancer"
},
{
"endpoints": [
{
"region": "DFW",
"tenantId": "717071",
"publicURL": "https://dfw.databases.api.rackspacecloud.com/v1.0/717071"
},
{
"region": "ORD",
"tenantId": "717071",
"publicURL": "https://ord.databases.api.rackspacecloud.com/v1.0/717071"
}
],
"name": "cloudDatabases",
"type": "rax:database"
},
{
"endpoints": [
{
"region": "DFW",
"tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9",
"publicURL": "https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9",
"internalURL": "https://snet-storage101.dfw1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"
},
{
"region": "ORD",
"tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9",
"publicURL": "https://storage101.ord1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9",
"internalURL": "https://snet-storage101.ord1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"
}
],
"name": "cloudFiles",
"type": "object-store"
},
{
"endpoints": [
{
"region": "DFW",
"tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9",
"publicURL": "https://cdn1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"
},
{
"region": "ORD",
"tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9",
"publicURL": "https://cdn2.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9"
}
],
"name": "cloudFilesCDN",
"type": "rax:object-cdn"
},
{
"endpoints": [
{
"tenantId": "717071",
"publicURL": "https://servers.api.rackspacecloud.com/v1.0/717071",
"versionInfo": "https://servers.api.rackspacecloud.com/v1.0",
"versionList": "https://servers.api.rackspacecloud.com/",
"versionId": "1.0"
}
],
"name": "cloudServers",
"type": "compute"
},
{
"endpoints": [
{
"publicURL": "https://ord.blockstorage.api.rackspacecloud.com/v1/717071",
"tenantId": "717071",
"region": "ORD"
},
{
"region": "DFW",
"tenantId": "717071",
"publicURL": "https://dfw.blockstorage.api.rackspacecloud.com/v1/717071"
}
],
"name": "cloudBlockStorage",
"type": "volume"
}
],
"user": {
"id": "224085",
"roles": [
{
"id": "3",
"description": "User Admin Role.",
"name": "identity:user-admin"
}
],
"name": "myUsername",
"RAX-AUTH:defaultRegion": "DFW"
}
}
}