You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by as...@apache.org on 2011/06/09 11:48:03 UTC
svn commit: r1133756 - in /incubator/whirr/trunk: ./
cli/src/main/java/org/apache/whirr/cli/command/
cli/src/main/resources/META-INF/services/ core/ src/site/xdoc/
Author: asavu
Date: Thu Jun 9 09:48:03 2011
New Revision: 1133756
URL: http://svn.apache.org/viewvc?rev=1133756&view=rev
Log:
WHIRR-326. Use jclouds provider metadata to help with cloud provider configuration (asavu)
Added:
incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java
Modified:
incubator/whirr/trunk/CHANGES.txt
incubator/whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command
incubator/whirr/trunk/core/pom.xml
incubator/whirr/trunk/pom.xml
incubator/whirr/trunk/src/site/xdoc/configuration-guide.xml
Modified: incubator/whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/CHANGES.txt?rev=1133756&r1=1133755&r2=1133756&view=diff
==============================================================================
--- incubator/whirr/trunk/CHANGES.txt (original)
+++ incubator/whirr/trunk/CHANGES.txt Thu Jun 9 09:48:03 2011
@@ -6,6 +6,9 @@ Trunk (unreleased changes)
WHIRR-313. Add Hama as a Service. (Edward J. Yoon via tomwhite)
+ WHIRR-326. Use jclouds provider metadata to help with cloud
+ provider configuration (asavu)
+
IMPROVEMENTS
WHIRR-28. Add examples module (asavu)
Added: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java?rev=1133756&view=auto
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java (added)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/ListProvidersCommand.java Thu Jun 9 09:48:03 2011
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.apache.whirr.cli.command;
+
+import com.google.common.collect.ImmutableSet;
+import org.apache.whirr.ClusterControllerFactory;
+import org.apache.whirr.command.AbstractClusterCommand;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.Providers;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Set;
+
+public class ListProvidersCommand extends AbstractClusterCommand {
+
+ Set<String> testedComputeProviders = ImmutableSet.of("aws-ec2",
+ "cloudservers-us", "cloudservers-uk", "byon");
+
+ public ListProvidersCommand() {
+ super("list-providers", "Show a list of the supported providers",
+ new ClusterControllerFactory());
+ }
+
+ @Override
+ public int run(InputStream in, PrintStream out,
+ PrintStream err, List<String> args) throws Exception {
+
+ if (args.size() == 0) {
+ printUsage(out);
+
+ } else {
+ String type = args.get(0);
+
+ if ("compute".equals(type)) {
+ listComputeProviders(out);
+ } else if ("blobstore".equals(type)) {
+ listBlobstoreProviders(out);
+ }
+ }
+
+ return 0;
+ }
+
+ private void printUsage(PrintStream out) {
+ out.println("whirr list-providers <compute OR blobstore>");
+ }
+
+ private void listBlobstoreProviders(PrintStream out) {
+ for(ProviderMetadata blobstore : Providers.allBlobStore()) {
+ out.println("* " + blobstore.getName());
+
+ out.println("\tHomepage: " + blobstore.getHomepage());
+ out.println("\tConsole: " + blobstore.getConsole());
+ out.println("\tAPI: " + blobstore.getApiDocumentation());
+
+ out.println("\tConfiguration options:");
+
+ out.println("\t\twhirr.blobstore-provider = " + blobstore.getId());
+ out.println("\t\twhirr.blobstore-identity = <" + blobstore.getIdentityName() +">");
+ out.println("\t\twhirr.blobstore-credential = <" + blobstore.getCredentialName() + ">\n");
+ }
+ }
+
+ private void listComputeProviders(PrintStream out) {
+ for(ProviderMetadata provider : Providers.allCompute()) {
+ if (testedComputeProviders.contains(provider.getId())) {
+ out.println("* " + provider.getName() + " - tested");
+ } else {
+ out.println("* " + provider.getName());
+ }
+
+ out.println("\tHomepage: " + provider.getHomepage());
+ out.println("\tConsole: " + provider.getConsole());
+ out.println("\tAPI: " + provider.getApiDocumentation());
+
+ out.println("\tConfiguration options:");
+
+ out.println("\t\twhirr.provider = " + provider.getId());
+ out.println("\t\twhirr.identity = <" + provider.getIdentityName() + ">");
+ out.println("\t\twhirr.credential = <" + provider.getCredentialName() + ">\n");
+ }
+ }
+}
Modified: incubator/whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command?rev=1133756&r1=1133755&r2=1133756&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command (original)
+++ incubator/whirr/trunk/cli/src/main/resources/META-INF/services/org.apache.whirr.command.Command Thu Jun 9 09:48:03 2011
@@ -13,5 +13,6 @@ org.apache.whirr.cli.command.LaunchClust
org.apache.whirr.cli.command.DestroyClusterCommand
org.apache.whirr.cli.command.DestroyInstanceCommand
org.apache.whirr.cli.command.ListClusterCommand
+org.apache.whirr.cli.command.ListProvidersCommand
org.apache.whirr.cli.command.RunScriptCommand
org.apache.whirr.cli.command.VersionCommand
Modified: incubator/whirr/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/pom.xml?rev=1133756&r1=1133755&r2=1133756&view=diff
==============================================================================
--- incubator/whirr/trunk/core/pom.xml (original)
+++ incubator/whirr/trunk/core/pom.xml Thu Jun 9 09:48:03 2011
@@ -54,16 +54,8 @@
<artifactId>jclouds-log4j</artifactId>
</dependency>
<dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>aws-ec2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>cloudservers-us</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>cloudservers-uk</artifactId>
+ <groupId>org.jclouds</groupId>
+ <artifactId>jclouds-allcompute</artifactId>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
Modified: incubator/whirr/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/pom.xml?rev=1133756&r1=1133755&r2=1133756&view=diff
==============================================================================
--- incubator/whirr/trunk/pom.xml (original)
+++ incubator/whirr/trunk/pom.xml Thu Jun 9 09:48:03 2011
@@ -86,30 +86,16 @@
<artifactId>jclouds-log4j</artifactId>
<version>${jclouds.version}</version>
</dependency>
- <!-- Supported cloud providers. When adding a dependency here
- be sure to add a corresponding LICENSE file in lib. -->
<dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>aws-ec2</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>cloudservers-us</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>cloudservers-uk</artifactId>
+ <groupId>org.jclouds</groupId>
+ <artifactId>jclouds-allcompute</artifactId>
<version>${jclouds.version}</version>
</dependency>
- <!-- All cloud blob store providers are supported by default -->
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-allblobstore</artifactId>
<version>${jclouds.version}</version>
</dependency>
- <!-- End supported cloud providers. -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Modified: incubator/whirr/trunk/src/site/xdoc/configuration-guide.xml
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/src/site/xdoc/configuration-guide.xml?rev=1133756&r1=1133755&r2=1133756&view=diff
==============================================================================
--- incubator/whirr/trunk/src/site/xdoc/configuration-guide.xml (original)
+++ incubator/whirr/trunk/src/site/xdoc/configuration-guide.xml Thu Jun 9 09:48:03 2011
@@ -210,7 +210,7 @@ xsi:schemaLocation="http://maven.apache.
<tt>aws-ec2</tt>
</td>
<td>The name of the cloud provider. See the
- <a href="#cloud-provider-config">table below</a>for possible provider names.</td>
+ <a href="#cloud-provider-config">table below</a> for possible provider names.</td>
</tr>
<tr valign="top">
<td>
@@ -232,7 +232,7 @@ xsi:schemaLocation="http://maven.apache.
</td>
<td>none</td>
<td>The cloud identity. See the
- <a href="#cloud-provider-config">table below</a>for how this maps to the credentials for
+ <a href="#cloud-provider-config">table below</a> for how this maps to the credentials for
your provider.</td>
</tr>
<tr valign="top">
@@ -244,7 +244,7 @@ xsi:schemaLocation="http://maven.apache.
</td>
<td>none</td>
<td>The cloud credential. See the
- <a href="#cloud-provider-config">table below</a>for how this maps to the credentials for
+ <a href="#cloud-provider-config">table below</a> for how this maps to the credentials for
your provider.</td>
</tr>
<tr valign="top">
@@ -259,6 +259,12 @@ xsi:schemaLocation="http://maven.apache.
myuser:mypass</td>
</tr>
</table>
+
+ <p>You can see a list of all the available compute providers by running:</p>
+ <source>$ whirr list-providers compute</source>
+
+ <p>Note: we are testing only on aws-ec2 and cloudserver-us.</p>
+
<subsection name="BlobStore Provider Options"></subsection>
<table border="0">
<tr valign="top">
@@ -298,7 +304,7 @@ xsi:schemaLocation="http://maven.apache.
<tt>whirr.identity</tt>
</td>
<td>The blobstore identity. See the
- <a href="#cloud-provider-config">table below</a>for how this maps to the credentials for
+ <a href="#cloud-provider-config">table below</a> for how this maps to the credentials for
your provider.</td>
</tr>
<tr valign="top">
@@ -312,7 +318,7 @@ xsi:schemaLocation="http://maven.apache.
<tt>whirr.credential</tt>
</td>
<td>The blobstore credential. See the
- <a href="#cloud-provider-config">table below</a>for how this maps to the credentials for
+ <a href="#cloud-provider-config">table below</a> for how this maps to the credentials for
your provider.</td>
</tr>
<tr valign="top">
@@ -336,6 +342,12 @@ xsi:schemaLocation="http://maven.apache.
<td>The name of the container that Whirr should use to cache local files</td>
</tr>
</table>
+
+ <p>You can see a list of all the available blobstore providers by running</p>
+ <source>$ whirr list-providers blobstore</source>
+
+ <p>Note: we are testing only on aws-s3 and cloudfiles-us.</p>
+
<subsection name="Cluster State Store Options"></subsection>
<table border="0">
<tr valign="top">