RSS

Monthly Archives: November 2012

jclouds 1.5.3 Released With OpenStack Cinder and Rackspace Cloud Block Storage Support

jclouds 1.5.3 was officially released over the weekend. Another solid release from the jclouds community. Among a number of new features was the support I added for OpenStack Cinder and Rackspace Cloud Block Storage.

OpenStack Cinder

Cinder BlockCinder is the OpenStack block storage service. On physical machines, examples of block storage devices are hard drives and USB sticks. Cinder allows you to create persistent virtual block storage devices as volumes that can be attached to servers and mounted with filesystems. This means you can store any data on the volumes and that data will persist even if your server is terminated.

From an OpenStack API perspective there’s some historical context that will help you understand Cinder. Cinder was born out of the need to create an independent block storage service. However, originally, there was a block storage service in OpenStack called nova-volume that had its own API but was officially part of the Nova API. A new service for Cinder in OpenStack Folsom means a new Cinder API but this API was an exact copy of the nova-volume API in OpenStack Essex. This was done very deliberately to maintain backwards compatibility and ease the transition from nova-volume to Cinder. Both APIs now exist in Folsom but the Cinder API is the path forward where all new efforts will be focused.

Rackspace Cloud Block Storage

Cloud Block StorageCloud Block Storage (CBS) is Rackspace’s deployment of Cinder. This means it’s the Rackspace service that allows you to create volumes via the Cloud Control Panel, the CBS (Cinder) API, or jclouds! You can create standard volumes that work well for your everyday file system needs, and SSD volumes that deliver even higher performance for databases and other I/O-intensive applications. It also allows you to easily create a snapshot of your existing volumes that effectively act as a point-in-time backup.

To get started with jclouds and Cloud Block Storage check out the Getting Started: The Rackspace open cloud documentation, specifically the Working with Cloud Block Storage section. There are plenty of examples in the cloudblockstorage package of the Rackspace examples on how to use this essential new service. For instance, the CreateVolumeAndAttach.java is an end to end example of creating a volume, attaching it to a server, putting a filesystem on it, and mounting it for use to store persistent data.

Coda

Block storage is one of the fundamental building blocks (no pun intended) of computing. This has been an often requested feature for Rackspace and it’s great to help other developers use it by providing support for Cloud Block Storage and Cinder in jclouds. I encourage you to upgrade to jclouds 1.5.3 and checkout these new features.

 
Leave a comment

Posted by on November 20, 2012 in openstack, rackspace

 

New Tools for JSON and Git

I had to share a couple of shiny new tools that I’ve recently incorporated into my workflow.

For JSON

jq

jq is great for chewing through JSON data. One of the best parts is that it’s written in portable C and it has zero runtime dependencies. You can download a single binary and drop it into your path like so.

wget http://stedolan.github.com/jq/download/linux_x86_64/jq -O /usr/local/bin/jq

chmod a+x /usr/local/bin/jq

To get a token from the Rackspace open cloud I used to parse the JSON with python. It’s effective but[t] ugly.

TOKEN=`curl -s -X POST https://identity.api.rackspacecloud.com/v2.0/tokens -d ‘{“auth”: {“passwordCredentials”: {“username”:”uname”, “password”:”pword”}}}’ -H “Content-type: application/json” | python -c ‘import json,sys; response=json.loads(sys.stdin.read()); print response["access"]["token"]["id"]‘`

With jq it’s much shorter, simpler, and easy to understand.

TOKEN=`curl -s -X POST https://identity.api.rackspacecloud.com/v2.0/tokens -d ‘{“auth”: {“passwordCredentials”: {“username”:”uname”, “password”:”pword”}}}’ -H “Content-type: application/json” | jq -r .access.token.id`

For Git

gitBash prompt builder

This is a website for generating a function to put in your .bashrc or .bash_profile file to show your Git / Hg / Subversion repository information in your bash prompt. I found it easiest to put the code generated by the builder into a separate file at ~/.bash_git. Then I source that file at the end of my .bash_profile with

source ~/.bash_git

This is great when you’re working with many git repos (or even just one) as it can, at a glance, let you know what branch you’re on, if there are changes, how many commits you’re ahead, etc. Plus it livens up your prompt with a little colour. There can be a second or two pause when you first cd to a git dir of a large repo but it’s totally worth it. Here are some examples of what my command line looks like now.

jclouds (openstack-cinder △ ) $ git commit -a -m “blah”

jclouds () (☢  labs/pom.xml) $ git add .

jclouds (master) +6 $ ls

Coda

For me, adding new tools to my daily workflow is a big deal. In addition to having the features I want/need, they need to be fast and efficient so they don’t get in the way. I’ve been using both of these for a few weeks now and I can say they definitely fit the bill. I highly recommend them!

 
Leave a comment

Posted by on November 14, 2012 in git, json

 

OpenStack devstack on the Rackspace open cloud

devstackI’ve written about deploying devstack before in Contributing OpenStack Support to jclouds. That post covered running devstack locally in VirtualBox. I’ve been using that method for a while now but with a devstack env in VirtualBox, a jclouds dev env, browser, chat client, mail client, etc. etc. etc. all running on the same laptop it gets bogged down. I’m pretty sure I heard gears grinding and smoke was pouring out of the laptop at one point. I just don’t have the cores, RAM, and RPMs to run everything smoothly and you need smoothly or development starts to suck.

The biggest draw on resources is VirtualBox so it’s long past time to move that devstack VM to the cloud! Naturally I’m going to deploy on the Rackspace open cloud. It turns out this is significantly simpler/easier to do than deploying on VirtualBox.

Instructions

  1. If you don’t have one already, Sign Up for an open cloud account
  2. Go to the Cloud Control Panel
  3. Click Create Server
    1. Name: devstack-folsom
    2. Image: Ubuntu 12.04 LTS
    3. Size: 4GB RAM (you could probably get away with 2 GB)
  4. Click Create Server and note the password and IPv4 address (when it appears)
  5. When your server is Active, switch to a Terminal and run the following commands:
    1. ssh root@<IPv4 Address>
    2. apt-get update; apt-get install -y git
    3. git clone https://github.com/openstack-dev/devstack.git -b stable/folsom devstack/
    4. cd devstack/
    5. vim localrc # copy in the contents of this one
    6. ./stack.sh
  6. When devstack is done you can point your browser, OpenStack clients, and jclouds dev env all at <IPv4 Address>
  7. When you’re done with your development/testing you can delete the server to save money and just start fresh next time

Next

The next obvious thing to do is to automate the whole process above. I haven’t decided whether to do my own custom script or dive into something like CloudEnvy. Either way it needs to be automated but it’s always good to have the manual process documented to fall back on and understand everything end to end.

Coda

As you can see there are far fewer steps to creating a devstack env like this than on VirtualBox. There’s much less fiddling around with networking too. The big benefit for me though was the immediate increase in speed for the rest of my development tools on laptop.

 
6 Comments

Posted by on November 8, 2012 in devstack, jclouds, openstack, rackspace

 
 
Follow

Get every new post delivered to your Inbox.