incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH] Better response for the storage_volume attach and detach operations
Date Fri, 29 Jul 2011 16:28:28 GMT
On Jul 29, 2011, at 12:45 AM, marios@redhat.com wrote:

ACK.

  -- Michal

> From: marios <marios@redhat.com>
> 
> 
> Signed-off-by: marios <marios@redhat.com>
> ---
> server/server.rb |   23 ++++++++++++++++++-----
> 1 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/server/server.rb b/server/server.rb
> index f1a03f0..f4232fc 100644
> --- a/server/server.rb
> +++ b/server/server.rb
> @@ -623,8 +623,15 @@ 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)
> +      respond_to do |format|
> +        format.html{ redirect(storage_volume_url(params[:id]))}
> +        format.xml do
> +          response.status = 202
> +          haml :"storage_volumes/show"
> +        end
> +        format.json {convert_to_json(:storage_volume, @storage_volume)}
> +      end
>     end
>   end
> 
> @@ -634,9 +641,15 @@ 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)
> +      respond_to do |format|
> +        format.html{ redirect(storage_volume_url(params[:id]))}
> +        format.xml do
> +          response.status = 202
> +          haml :"storage_volumes/show"
> +        end
> +        format.json {convert_to_json(:storage_volume, @storage_volume)}
> +      end
>     end
>   end
> 
> -- 
> 1.7.3.4
> 

----------------------------------------------------------------------
Michal Fojtik, Senior Software Engineer, Red Hat Czech
mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


Mime
View raw message