Discussion:
Can't create volume from image in Openstack
Quentin Hartman
2015-02-05 18:47:02 UTC
Permalink
I'm able to create empty volumes just fine, but when I try to specify an
image:

service = Fog::Compute.new({ auth stuff here})
v = service.create_volume('test volume','A testing volume created with
fog', 5, {imageRef: '851ebad1-4cfe-468f-94a7-08dfc6b2d29d'})

It does not work correctly. I've been able to confirm on the server side
that when the request comes in, the imageRef parameter is empty. I've tried
several different permutations of passing the options, and the results are
all the same. The code indicates that this should be
supported: https://github.com/fog/fog/blob/master/lib/fog/openstack/requests/volume/create_volume.rb

It seems that fog is not passing this through the nova-api, which would
seem to be correct as the volumes extension of nova-api does not seem to
support the imageRef option. (Here's the API reference:
http://developer.openstack.org/api-ref-compute-v2-ext.html)

If I hit cinder directly though, it works as expected. For example:

Hitting nova-api's volume extension with a curl reconstruction of the call
that fog makes, even with the imageref and bootable flags added, creates an
empty volume: curl -s -H "X-Auth-Token: $TOKEN" -X POST -H "Content-Type:
application/json"
http://openstack-api.local:8774/v2/b5901343f263457aab3ef432fae3c656/os-volumes
-d "{\"volume\":{\"display_name\":\"test
volume\",\"display_description\":\"A testing volume created with
fog\",\"size\":5,\"imageRef\":\"851ebad1-4cfe-468f-94a7-08dfc6b2d29d\",\"bootable\":true}}"

Hitting cinder-api with curl, and the identical request (except hitting
/volumes instead of /os-volumes since I'm no longer using the nova volumes
extension), creates a volume from the image as expected: curl -s -H
"X-Auth-Token: $TOKEN" -X POST -H "Content-Type: application/json"
http://openstack-api.local:8776/v2/b5901343f263457aab3ef432fae3c656/volumes
-d "{\"volume\":{\"display_name\":\"test
volume\",\"display_description\":\"A testing volume created with
fog\",\"size\":5,\"imageRef\":\"851ebad1-4cfe-468f-94a7-08dfc6b2d29d\",\"bootable\":true}}"

It seems like with Fog, we should be making this request to the cinder
endpoint rather than the nova endpoint.
Is this something I'm doing wrong? Should I be doing something else to
create a volume from an image in Fog, or is it a bug in Fog?

Any thoughts or input would be helpful.

QH
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...