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 2/2] Add CIMI::Volume delete operation
Date Mon, 12 Dec 2011 10:02:07 GMT
Hi,

ACK to both patches.

  -- Michal

On Dec 9, 2011, at 7:55 PM, marios@redhat.com wrote:

> From: marios <marios@redhat.com>
> 
> 
> Signed-off-by: marios <marios@redhat.com>
> ---
> server/lib/cimi/model/machine.rb |    2 +-
> server/lib/cimi/model/volume.rb  |    4 ++++
> server/lib/cimi/server.rb        |   13 +++++++++++--
> 3 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/server/lib/cimi/model/machine.rb b/server/lib/cimi/model/machine.rb
> index 8f31bc6..d2673e7 100644
> --- a/server/lib/cimi/model/machine.rb
> +++ b/server/lib/cimi/model/machine.rb
> @@ -85,7 +85,7 @@ class CIMI::Model::Machine < CIMI::Model::Base
>     if machine_template.has_key? 'MachineAdmin'
>       additional_params[:keyname] = machine_template['machineAdmin'][0]["href"].split('/').last
>     end
> -    instance = context.driver.create_instance(context.credentials, image_id, { 
> +    instance = context.driver.create_instance(context.credentials, image_id, {
>       :hwp_id => hardware_profile_id
>     }.merge(additional_params))
>     from_instance(instance, context)
> diff --git a/server/lib/cimi/model/volume.rb b/server/lib/cimi/model/volume.rb
> index 63dcf86..cb9a34f 100644
> --- a/server/lib/cimi/model/volume.rb
> +++ b/server/lib/cimi/model/volume.rb
> @@ -60,6 +60,10 @@ class CIMI::Model::Volume < CIMI::Model::Base
>     create_volume({:volume_config_id=>volume_config_id, :volume_image_id=>volume_image_id},
context)
>   end
> 
> +  def self.delete!(id, context)
> +    context.driver.destroy_storage_volume(context.credentials, {:id=>id} )
> +  end
> +
>   private
> 
>   def self.create_volume(params, context)
> diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
> index c0d2627..77a8d04 100644
> --- a/server/lib/cimi/server.rb
> +++ b/server/lib/cimi/server.rb
> @@ -249,8 +249,8 @@ global_collection :machines do
>     end
>   end
> 
> -  operation :delete, :method => :delete, :member => true do
> -    description "Reboot specific machine."
> +  operation :destroy do
> +    description "Delete a specified machine."
>     param :id,          :string,    :required
>     control do
>       Machine.delete!(params[:id], self)
> @@ -356,6 +356,15 @@ global_collection :volumes do
>     end
>   end
> 
> +  operation :destroy do
> +    description "Delete a specified Volume"
> +    param :id, :string, :required
> +    control do
> +      Volume.delete!(params[:id], self)
> +      no_content_with_status(200)
> +    end
> +  end
> +
> end
> 
> global_collection :volume_configurations do
> -- 
> 1.7.6.4
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


Mime
View raw message