Hi Everett:
Thanks for the link, esp the [2].
Since we are on the Cinder topic, i see that the nova CLI is able to do:
$ nova boot --flavor <flavor> --block_device_mapping <dev_name>=<id>:<type>:<size>:<delete_on_terminate> <name>
see link below:

Just wonder if you have any code sample to do this with JCloud's API or point me in the direction how to do this.


On Wed, Aug 7, 2013 at 5:52 PM, Everett Toews <everett.toews@rackspace.com> wrote:
On Aug 7, 2013, at 11:15 AM, Bk Lau wrote:

> Hi:
> Currently NovaApi.class exposes the VolumeApi and VolumeAttachmentApi. I don't see a Volume.Status.ATTACHING state.
> But with the Cinder Vol/Attachment API, there is one.
> My question is: How does JCloud's  NovaApi class
> automatically return one over the other?.

It won't. These are really separate APIs and jclouds treats them as such.

If you're coding to org.jclouds.openstack.cinder.v1.features.VolumeApi, you'll get anything available in that API.

If you're coding to org.jclouds.openstack.nova.v2_0.extensions.VolumeApi, you'll get anything available in that API.

Historically speaking in OpenStack, the Nova Volume API was copied over to the Cinder API v1. The Nova Volume API was then deprecated so you will only find it in older OpenStack deployments. The Cinder API is the way forward for block storage in OpenStack.

> More specifically, if Cinder is available,
> would  NovaAPI.getVolumeExtensionForZone(...)
> returns the Cinder version?

No. The Volume API in Nova is separate from the Cinder service in OpenStack.

NovaApi.getVolumeExtensionForZone(...) will only ever return the Nova Volume API.

> If not how does one determine if Cinder is supported and
> get the Cinder Api in JCloud?

The block storage feature will typically be advertised by your OpenStack provider in some way. "Hey! Use our block storage service!"

To programmatically determine if it's supported you can try to create a CinderApi like so [1] or manually authenticate [2] and iterate through the service catalog looking for the cinder service.


[1] https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/cloudblockstorage/CreateVolumeAndAttach.java#L120-124

[2] http://blog.phymata.com/2013/06/17/jclouds-manual-authentication-with-openstack/