On 09/01/13 12:38, Michal Fojtik wrote:
> On 01/08, [email protected] wrote:
>
> One minor nit inline.
>
>> From: marios <[email protected]>
>>
>> also fixes for create route display of new snapshot
>>
>> Signed-off-by: marios <[email protected]>
>> ---
>> .../lib/deltacloud/collections/storage_snapshots.rb | 6 +++++-
>> server/lib/deltacloud/drivers/mock/mock_driver.rb | 20
>> ++++++++++++++++++++
>> 2 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/server/lib/deltacloud/collections/storage_snapshots.rb
>> b/server/lib/deltacloud/collections/storage_snapshots.rb
>> index 5d5ac53..dca253a 100644
>> --- a/server/lib/deltacloud/collections/storage_snapshots.rb
>> +++ b/server/lib/deltacloud/collections/storage_snapshots.rb
>> @@ -31,7 +31,11 @@ module Deltacloud::Collections
>> @storage_snapshot = driver.create_storage_snapshot(credentials,
>> params)
>> status 201 # Created
>> response['Location'] = storage_snapshot_url(@storage_snapshot.id)
>> - show(:storage_snapshot)
>> + respond_to do |format|
>> + format.xml { haml :"storage_snapshots/show" }
>> + format.html { haml :"storage_snapshots/show" }
>> + format.json { xml_to_json "storage_snapshots/show" }
>
> Is it really necessary to remove 'show(:storage_snapshot)' helper here?
the show helper makes sense when there is 'params[:id]' - like in a GET
operation. This being a create, params[:id] is nil and so the result of
show is unexpected (in this case for mock it just gave me the first
snapshot),
marios
>
>> + end
>> end
>> end
>>
>> diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb
>> b/server/lib/deltacloud/drivers/mock/mock_driver.rb
>> index 38cb042..b12ca57 100644
>> --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
>> +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
>> @@ -314,6 +314,26 @@ module Deltacloud::Drivers::Mock
>> snapshots
>> end
>>
>> + def create_storage_snapshot(credentials, opts={})
>> + check_credentials(credentials)
>> + id = "store_snapshot_#{Time.now.to_i}"
>> + snapshot = {
>> + :id => id,
>> + :created => Time.now.to_s,
>> + :state => "COMPLETED",
>> + :storage_volume_id => opts[:volume_id],
>> + }
>> + snapshot.merge!({:name=>opts[:name]}) if opts[:name]
>> + snapshot.merge!({:description=>opts[:description]}) if
>> opts[:description]
>> + @client.store(:storage_snapshots, snapshot)
>> + StorageSnapshot.new(snapshot)
>> + end
>> +
>> + def destroy_storage_snapshot(credentials, opts={})
>> + check_credentials(credentials)
>> + @client.destroy(:storage_snapshots, opts[:id])
>> + end
>> +
>> def keys(credentials, opts={})
>> check_credentials(credentials)
>> result = @client.build_all(Key)
>> --
>> 1.7.11.7
>>
>