May 2, 2012

New toys in 1.5.0-alpha.6

We are very near beta, I promise!  In the mean time, we just cut a new codebase with a bunch of cool new toys.  Here’s a few.

Thanks to Adam Lowe, we are getting even deeper into OpenStack with more Keystone support than ever. Setup your code to pull org.jclouds.labs/openstack-keystone, and you can do stuff like this:

      ContextBuilder contextBuilder = ContextBuilder.newBuilder("openstack-keystone");
      RestContext keystone = contextBuilder
         .credentials("tenantId:user", "password")
         .endpoint("https://keystone:35357")
         .build();

      for (String regionId : keystone.getApi().getConfiguredRegions()) {
         AdminClient adminClient = keystone.getApi().getAdminClientForRegion(regionId);
         for (Tenant tenant : adminClient.listTenants()) {
            // ...
         }
      }

Also pro, is our new Amazon CloudWatch support from Jeremy Whitlock. This is our first complete renovation of an AWS api to have the same look/feel as our new OpenStack stuff.  Just add a dependency on org.jclouds.providers/aws-cloudwatch and you can do this!

      ContextBuilder contextBuilder = ContextBuilder.newBuilder("aws-cloudwatch");
      RestContext cloudwatch = contextBuilder
         .credentials("accessKey", "secretKey")
         .build();

      for (String regionId : cloudwatch.getApi().getConfiguredRegions()) {
         MetricClient metricClient = cloudwatch.getApi().getMetricClientForRegion(regionId);
         for (Metric metric : metricClient.listMetrics()) {
            // ...
         }
      }

And for the jenkins users, we also have an api for remote job and computer control, at org.jclouds.labs/jenkins!

      ContextBuilder contextBuilder = ContextBuilder.newBuilder("jenkins");
      RestContext localhost = contextBuilder.build();
      
      Node master = localhost.getApi().getMaster();
      localhost.getJobClient().createFromXML("newJob", xmlAsString);

This is especially helpful with the new jclouds-plugin, which uses jclouds to spin up new slaves and publish artifacts to BlobStore. Tons more in there, too.

Definitely play around, and let us know how it works!

March 23, 2012

Take a peek at vCloud Director 1.5, OpenStack, and VirtualBox

The jclouds team have been working very hard lately, particularly on a few new apis.  We’ve decided to cage them no longer and cut jclouds 1.5.0-alpha.1:

Most notably, we’ve added the openstack-nova api, and three new providers, all of which discovered via OpenStack Keystone v2.0:

  • trystack-nova
  • hpcloud-compute
  • hpcloud-objectstorage

Here’s how to boot up a new machine and add your login using the new hpcloud-compute provider in clojure:

(use 'org.jclouds.compute2)
(import 'org.jclouds.scriptbuilder.statements.login.AdminAccess)
(def compute
(compute-service "hpcloud-compute" "tenantId:ACCESSKEY" "SECRETKEY"
:slf4j :sshj)) (create-node compute "test"
(build-template compute { :run-script (AdminAccess/standard) } ))

Here’s an example of how to do the same on TryStack, authenticating w/ user & pass as opposed to key, via our java example:

java -jar target/compute-basics-jar-with-dependencies.jar \
trystack-nova tenantId:user password mygroup add

In the group org.jclouds.labs, you’ll find two more new and notable members of the jclouds family:

  • vcloud-director: supports 250 user and admin operations defined in the vCloud Director 1.5 ReST API
  • virtualbox: start a group of vms on your laptop, provided an iso location for ubuntu

You can try out virtualbox like any other api.  For example, you can use the clojure above, only changing how you create the connection slightly:

(def compute (compute-service "virtualbox" "administrator" "12345" :sshj :slf4j))

The code in labs will certainly change before we release a beta, but feel free to check them out.  Meanwhile, you can try them out and give us feedback on #jclouds irc freenode or jclouds-dev google group!

Finally, many thanks to the dozen contributors who’s work is in this alpha, and particularly HP and VMware for sponsoring substantial effort.

Oh, and don’t forget to clean up your nodes :)

(destroy-nodes-matching compute (constantly true))
March 9, 2012

EC2 gets rid of that “if instancetype.is32bit” statement

2 weeks ago, I started a bit of a rant on EC2’s 32bit-only vms.

32bit vms make me angry

hey, ! deprecate m1.small for a new 64bit t1.small

any chance of a future blog titled: m1.small is dead. long live t1.small!

This occurred on freenode and twitter, mainly due to pent-up frustration, set off by needing a separate if statement in our JDK installer just to accommodate the lame 32bit m1.small instance.

I’m not (quite) self-absorbed enough to think Jeff Barr’s latest announcement was in response to this.  Even if I was, my mention never reached him! (my tweet went to the less interested jeffbar, yeah the only one ‘r’ one)  Nevertheless, our prayers were answered, and reported by the real @jeffbar:

EC2 Updates: New Medium Instance, 64-bit Ubiquity, SSH Client

Here’s the jist: Instead of deprecating the old m1.small, they updated it to support 64bit images (and also the c1.medium).  To sweeten the deal, they also threw in a new m1.medium size, which is roughly a 2x m1.small.

Now, all users producing images don’t have to make a 32bit option just cause they need more ram than t1.micro.  In fact, many will probably drop the maintenance entirely.

For jclouds users, action is simple, update to version 1.3.2 which removes the restriction of m1.small’s only being able to use 32bit amis.

January 21, 2012

jclouds 1.3 released!

The 1.3 release of jclouds includes results of 3-months effort by our contributors. A total of 57 Issues were addressed between jclouds 1.2.0 and the current revision of jclouds 1.3 (1.3.1).

Notable updates include

  • support for Citrix CloudStack 2.2.13+
  • support for vCloud Director 1.5 endpoints
  • support for OpenStack Nova via our eucalyptus support

This release also supports more locations than ever including:

  • introduction of Ninefold compute in Sydney and HP Cloud Object Storage in SuperNAP (vegas)
  • new aws-ec2 regions in Oregon and Sao Paulo
  • new ElasticHosts zones in Toronto and Los Angeles

We also have a few new tricks for power users

As always, we keep our examples site up to date so you can see how to work this stuff. Also, check out recent jclouds integrations including Abiquo 2.0, Apache Camel, ElasticInbox, and GigaSpaces Cloudify.

Please submit your own ideas and let us know if there are features you’d like to see, need help on, or are interested in contributing. Make sure you follow us on Twitter for updates. If you are interested in learning about jclouds 1.3 IRL, come to our training in Stockholm or our next meetup at Jfokus

Credits

Special thanks to Alcatel Lucent for sponsoring the majority of our CloudStack implementation, and the CloudStack community for answering hundreds of questions over the last year! Additional thanks to Jeremy Daggett from HP for contributing HP Cloud Object Storage support, and setting stage for further OpenStack improvements in future releases. Also thanks to Jesse Wilson from Gson, who took time with us to hone our use of Gson to the point where we no longer require patches.

Finally, thanks to everyone who contributed their time and effort in order to make this release happen. Check out who’s been busy here.

More info?

Check out the release notes for more info on this release!

January 17, 2012

jclouds training and Jfokus Stockholm

For those of you in Stockholm, or coming in for Jfokus, don’t miss out on a few nearby events.

I’ll also be doing some cloud tracking at JFokus and generally available for beer :)

See you in freezing Stockholm!
-Adrian

October 18, 2011

jclouds 1.2 released!

The 1.2 release of jclouds includes results of almost 2 months effort by our community. A total of 55 Issues were addressed between jclouds 1.1 and 1.2, stabilizing the cloud so you don’t have to!

We now support 33 cloud providers and reach 8 new data centers from CloudSigma, Go2Cloud, and SoftLayer.

We’ve made sysadminy tasks more programmable, and feel more like Java.  Using submitScriptOnNode, you can use java concurrent semantics for bash scripts!

future = client.submitScriptOnNode(node.getId(), 
                        AdminAccess.builder().adminUsername("foo").build(),
                        nameTask("adminUpdate"));

As always, we keep our examples site up to date so you can see how to work this stuff.

Next release will be in approximately 1-months time. Look out for progress including vCloud 1.5, Voxel, and VirtualBox.

For full details on the jclouds 1.2.1 release, check out our release notes.

Catch up with us on twitter, irc, the mailing-list, or IRL at one of the many upcoming events.

Great job, team!

October 17, 2011

Resurrecting Tumblr

Blogger accidentally marked the jclouds blog as spam, and won’t reinstate it.  Future blog entries will go here!

May 20, 2009
May 13, 2009

Catching exceptions with less keystrokes

Some of us hate checked exceptions, but still use them for one reason or another.  A common problem we have is unnecessary exception nesting, or runtime swallowing.  This often leads to the all to familiar and crufty code with a million catch blocks.

jclouds has a slightly different approach that strikes a balance, allowing checked exceptions to be dealt with, but without the pain of so many lines of repetitious code.

	try{
        } catch (Exception e) {
	    Utils.<ApplicationException>rethrowIfRuntimeOrSameType(e);
	    throw new ApplicationException("Error applying stuff", e);
	}


This code does what it says, preventing us from unnecessarily nesting application exceptions or swallowing runtimes.

Now, this code shouldn’t work, as current versions of java hava a generic type erasure problem.  The reason it does work is a somewhat hackish line in the rethrowIfRuntimeOrSameType method:

        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        } else {
            try {
                throw (E) e;
            } catch (ClassCastException throwAway) {
                // using cce as there's no way to do instanceof E in current java
            }
        }

The trick is that we try to force the exception we caught into the generic type. If that fails, we know it wasn’t that type and that we should wrap, log, etc.

If nothing else, I hope you enjoy the perspective!

May 11, 2009

jclouds-s3 beta released

logo

jclouds provides any-weight clouds tools for Java 5 and later: you choose the depth you want.

We are pleased to announce our first beta of jclouds-s3.

jclouds-s3 provides both Map<String,InputStream> and FutureCommand interfaces to Amazon S3.

It features a pluggable core, most notably supporting Apache HttpNio and Google App Engine for Java runtimes.

Please have a look at our project page and give it a try.  We welcome your feedback and participation.

adrian@jclouds.org