I am running into a similar problem, and Rupak's solution below does not
work for me. I've also tried using the create_volume method with no luck.
Here's a snippet from an irb session:
v = service.create_volume('test volume','A testing volume crete with fog',
200, options={imageRef:'851ebad1-4cfe-468f-94a7-08dfc6b2d29d'})
=> #<Excon::Response:0x00000002149e50
@data={:body=>{"volume"=>{"status"=>"creating", "displayDescription"=>"A
testing volume crete with fog", "availabilityZone"=>"nova",
"displayName"=>"test volume", "attachments"=>[{}], "volumeType"=>"None",
"snapshotId"=>nil, "metadata"=>{},
"id"=>"2cce91b0-79a1-45b9-ac17-c6298ed69336",
"createdAt"=>"2015-02-04T23:11:27.514360", "size"=>200}},
:headers=>{"Location"=>"http://openstack-api.local:8774/v2/b5901343f263457aab3ef432fae3c656/os-volumes/2cce91b0-79a1-45b9-ac17-c6298ed69336",
"Content-Type"=>"application/json", "Content-Length"=>"330",
"X-Compute-Request-Id"=>"req-4a15ea1a-4846-4a36-8dca-0dd7d59b8b61",
"Date"=>"Wed, 04 Feb 2015 23:11:27 GMT"}, :status=>200,
:reason_phrase=>"OK", :remote_ip=>"10.10.10.13", :local_port=>52750,
:local_address=>"10.10.10.100"}, @body="{\"volume\": {\"status\":
\"creating\", \"displayDescription\": \"A testing volume crete with fog\",
\"availabilityZone\": \"nova\", \"displayName\": \"test volume\",
\"attachments\": [{}], \"volumeType\": \"None\", \"snapshotId\": null,
\"metadata\": {}, \"id\": \"2cce91b0-79a1-45b9-ac17-c6298ed69336\",
\"createdAt\": \"2015-02-04T23:11:27.514360\", \"size\": 200}}",
@headers={"Location"=>"http://openstack-api.local:8774/v2/b5901343f263457aab3ef432fae3c656/os-volumes/2cce91b0-79a1-45b9-ac17-c6298ed69336",
"Content-Type"=>"application/json", "Content-Length"=>"330",
"X-Compute-Request-Id"=>"req-4a15ea1a-4846-4a36-8dca-0dd7d59b8b61",
"Date"=>"Wed, 04 Feb 2015 23:11:27 GMT"}, @status=200,
@remote_ip="10.10.10.13", @local_port=52750, @local_address="10.10.10.100">
An empty volume gets correctly created, so I assume I am doing something
wrong with passing the imageRef, but every permutation I've tried that
makes any sense at all gives me the same result or worse.
Thanks!
QH
On Wednesday, October 15, 2014 at 7:18:28 AM UTC-6, J Ro wrote:
>
> Hi,
>
> When I use cinder to create a volume from an image, it works. Here is the
> debug HTTP request:
>
> DEBUG:keystoneclient.session:REQ: curl -i -X POST
> http://XXX:8776/v1/96b7fa2fb01c47bb884a1f97e091b8a0/volumes -H
> "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H
> "Accept: application/json" -H "X-Auth-Token: TOKEN_REDACTED" -d '{"volume":
> {"status": "creating", "availability_zone": null, "source_volid": null,
> "display_description": null, "snapshot_id": null, "user_id": null, "size":
> 20, "display_name": "volfromsnap", "imageRef":
> "da5e5085-db75-4b0b-90fd-c82e887f4a1a", "attach_status": "detached",
> "volume_type": null, "project_id": null, "metadata": {}}}'
>
> However, when attempting this with fog, the imageRef is not being sent:
>
> Ruby code:
>
> v = volume_service.volumes.create(size: 20, display_name: 'tester123',
> display_description: 'Fog Testing1', options: {imageRef:
> 'da5e5085-db75-4b0b-90fd-c82e887f4a1a'})
> HTTP Request:
>
> POST /v1/c297330967f242549e184e648d657e6f/volumes HTTP/1.1
>
> {"volume":{"display_name":"tester123","display_description":"Fog
> Testing1","size":20}}
>
> From
> https://github.com/fog/fog/blob/master/lib/fog/openstack/requests/volume/create_volume.rb,
>
> it looks like these options should be parsed, but they are not being sent
> by the client. Any ideas?
>
> Thanks!
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.