Hi: On 29/11/12 05:42, Ronelle Landy wrote: >> From: "[email protected]" <[email protected]> >> To: [email protected] >> Cc: "Michal Fojtik" <[email protected]> >> Sent: Wednesday, November 28, 2012 12:24:28 PM >> Subject: Re: CIMI MachineVolumes collection attach/detach volume >> >> On 28/11/12 14:24, Michal Fojtik wrote: >>> On 11/28, [email protected] wrote: >>> >>> Nicely done. ACK to this series. I also prepared a patch[1] for >>> Sinatra::Rabbit to support operations with same name but different >>> HTTP >>> method. But I think having a sub-collection here is better idea :-) >>> >> >> Thanks a lot for doing that - I tested it and it works fine (comments >> on >> the pull request). I think its still very useful to have this ability >> because it means we can expose the 'attach' volume route as >> >> PUT /cimi/machines/:id/volumes (now we have /volume_attach) >> >> and still have the regular >> >> GET /cimi/machines/:id/volumes >> >> marios >> >>> One minor nit: There are no unit tests for this stuff :) >>> >>> [1] https://github.com/mifo/sinatra-rabbit/pull/12 >>> >>>> >>>> Attach volume to Machine >>>> >>>> XML: >>>> >>>> curl -v --user "mockuser:mockpassword" -H "Content-Type: >>>> application/xml" >>>> -H "Accept: application/xml" -X PUT -d >>>> '<MachineVolume >>>> xmlns="http://schemas.dmtf.org/cimi/1/MachineVolume"> >>>> <initialLocation> /dev/sdf </initialLocation> >>>> <volume href="http://localhost:3001/cimi/volumes/vol2"/> >>>> </MachineVolume>' >>>> http://localhost:3001/cimi/machines/inst1/volume_attach >>>> >>>> JSON: >>>> >>>> curl -v --user "mockuser:mockpassword" -H "Content-Type: >>>> application/json" >>>> -H "Accept: application/xml" -X PUT -d >>>> '{"resourceURI":"http://schemas.dmtf.org/cimi/1/MachineVolume", >>>> "initialLocation": "/dev/sdf", >>>> "volume": {"href":"http://localhost:3001/cimi/volumes/vol2"}}' >>>> http://localhost:3001/cimi/machines/inst1/volume_attach >>>> >>>> Detach volume (remove MachineVolume from the >>>> MachineVolumeCollection): >>>> >>>> curl -v --user "mockuser:mockpassword" -H "Accept: >>>> application/xml" >>>> -X DELETE >>>> http://localhost:3001/cimi/machines/inst1/volumes/vol2 > > The above works to detach a volume from a machine. However, you can create a > volume, and never attach it. In the case that I want to delete this volume > (w/o ever attaching it), I tried: > > curl -X DELETE --user "mockuser:mockpassword" > "http://cloud-qe-3.idm.lab.bos.redhat.com:3001/cimi/volumes/Volume1354146026?format=xml" >
thanks! Again, this is a pre-existing issue (wasn't me guvnor!) - it just seems that CIMI volumes hasn't had much attention. I fixed the issue you mention here and also added the 'delete' URI to each entry in the Volume collection. Patches are at http://tracker.deltacloud.org/set/162 thanks, marios > and got ... > <error status='500' url='/cimi/volumes/Volume1354146026'> > > "DELETE /cimi/volumes/Volume1354146166 HTTP/1.1" 500 1518 0.0385 > E, [2012-11-28T18:43:45.570420 #17963] ERROR -- 500: [TypeError] nil is not a > symbol > > /home/dcloud/workspace/deltacloud/server/lib/cimi/collections/volumes.rb:19:in > `respond_to?' > /home/dcloud/workspace/deltacloud/server/lib/cimi/collections/volumes.rb:19:in > `block in <class:Volumes>' > /usr/local/share/gems/gems/sinatra-rabbit-1.1.3/lib/sinatra/rabbit/base.rb:384:in > `block in control' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `call' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `block > in compile!' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `[]' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `block (3 > levels) in route!' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in > `route_eval' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `block (2 > levels) in route!' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:872:in `block in > process_route' > /usr/local/share/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in `catch' > > >>>> >>>> >>>> write-up and more info @ >>>> http://mariosandreou.com/deltacloud/cloud_API/2012/11/28/cimi-machine-volumes-collection.html >>>> >>>> marios >>> >> >>
