RSS

jclouds and OpenStack

04 Sep

OpenStack

Update: Using jclouds 1.5.1

Getting jclouds and your own OpenStack deployment working together can be just a bit tricky as there are a couple of special configurations you need to make.

I’ve described how to get started with jclouds before but the other piece of this puzzle is your own OpenStack deployment. For easy and reliable testing I just run my own devstack install of OpenStack. Setting up devstack has been written about many times elsewhere so the only thing that I’ll say about it here is that I use an Ubuntu 12.04 Server VM running in VirtualBox. The trickiest part of that setup is the networking so I posted my VirtualBox settings on this question on ServerFault. After that it’s just a matter of following the devstack instructions.

Here’s the code for connecting to OpenStack. It’s very similar to the getting started example with a few key differences. In the init() method notice that

  • String provider = "openstack-nova";
    • This ones pretty self explanatory, we’re using the OpenStack Nova provider in jclouds
  • String identity = "demo:demo"; // tenantName:userName
    • Here we use the tenant name and user name with a colon between them instead of just a user name
  • String password = "devstack";
    • Instead of using the API key I’m using the password I set when devstack did its installation
  • .endpoint("http://172.16.0.1:5000/v2.0/")
    • This is the Keystone endpoint that jclouds needs to connect with to get more info (services and endpoints) from OpenStack
    • When the devstack installation completes successfully, one of the last few lines will read something like “Keystone is serving at http://172.16.0.1:5000/v2.0/
    • Set the endpoint to this URL

To get everything compiling and running do the following.

This post was written on Mac OS X 10.7.4, Java 1.6.0, jclouds 1.5.1 1.5.0-beta.10, and OpenStack Essex. If you’re on a different OS and run into problems, please feel free to comment.

 
14 Comments

Posted by on September 4, 2012 in jclouds, openstack

 

14 Responses to jclouds and OpenStack

  1. Reynaldi Prasetyo

    September 27, 2012 at 5:49 am

    Hi.. Everett ..
    i’m trying your script in my eclipse, but it have error in listImages() :
    java.lang.Error: Unresolved compilation problem:
    The method listImages() is undefined for the type ImageApi

    i’m newbie in jclouds, please help,..
    thanks :)

     
  2. Reynaldi Prasetyo

    September 30, 2012 at 9:23 pm

    Thanks, Everett.
    your amazing …
    now, I can run it… :)

    Can I ask something? How to connect Azure with jclouds, Is the same with your getting started tutorial ??

    Thanks …

     
  3. Werner Buck

    April 19, 2013 at 9:47 am

    Is it possible to launch instances on openstack in virtualbox?

     
    • Everett Toews

      April 19, 2013 at 10:25 am

      Yep. But you’ll want to keep the instance sizes small.

       
  4. Shankar

    June 14, 2013 at 3:45 pm

    Is it possible to get the tenant ID via jclouds ? I’ve tried various options – none of them seem to give the tenant ID.

     
  5. syed

    June 18, 2013 at 12:34 am

    is it possible to create image and do other CRUD operation on image using openstack jclouds api? Does jclouds provide support for glance?

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: