incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1152146 - /incubator/deltacloud/trunk/server/server.rb
Date Fri, 29 Jul 2011 08:52:08 GMT
Author: marios
Date: Fri Jul 29 08:52:08 2011
New Revision: 1152146

URL: http://svn.apache.org/viewvc?rev=1152146&view=rev
Log:
Fix response codes for attach/detach storage volumes (send 202
Accepted status and details of the volume)

Modified:
    incubator/deltacloud/trunk/server/server.rb

Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1152146&r1=1152145&r2=1152146&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Fri Jul 29 08:52:08 2011
@@ -623,8 +623,13 @@ collection :storage_volumes do
     param :instance_id,:string,  :required
     param :device,     :string,  :required
     control do
-      driver.attach_storage_volume(credentials, params)
-      redirect(storage_volume_url(params[:id]))
+      @storage_volume = driver.attach_storage_volume(credentials, params)
+      status 202
+      respond_to do |format|
+        format.html { redirect(storage_volume_url(params[:id]))}
+        format.xml  { haml :"storage_volumes/show" }
+        format.json { convert_to_json(:storage_volume, @storage_volume) }
+      end
     end
   end
 
@@ -634,9 +639,13 @@ collection :storage_volumes do
     param :id,         :string,  :required
     control do
       volume = driver.storage_volume(credentials, :id => params[:id])
-      driver.detach_storage_volume(credentials, :id => volume.id, :instance_id => volume.instance_id,
-                                   :device => volume.device)
-      redirect(storage_volume_url(params[:id]))
+      @storage_volume =  driver.detach_storage_volume(credentials, :id => volume.id, :instance_id
=> volume.instance_id, :device => volume.device)
+      status 202
+      respond_to do |format|
+        format.html { redirect(storage_volume_url(params[:id]))}
+        format.xml  { haml :"storage_volumes/show" }
+        format.json { convert_to_json(:storage_volume, @storage_volume) }
+      end
     end
   end
 



Mime
View raw message