From 60e0f34d166c76961c1fecd8cd19a73e6e7559a4 Mon Sep 17 00:00:00 2001 From: Rupak Ganguly Date: Thu, 5 Jul 2012 17:03:14 -0400 Subject: [PATCH] Add delete_volumes request method for block storage. --- lib/fog/hp/block_storage.rb | 2 +- .../requests/block_storage/delete_volume.rb | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 lib/fog/hp/requests/block_storage/delete_volume.rb diff --git a/lib/fog/hp/block_storage.rb b/lib/fog/hp/block_storage.rb index f6fc8cf0a..e6289abf2 100644 --- a/lib/fog/hp/block_storage.rb +++ b/lib/fog/hp/block_storage.rb @@ -14,7 +14,7 @@ module Fog request_path 'fog/hp/requests/block_storage' #request :create_volume - #request :delete_volume + request :delete_volume request :get_volume_details request :list_volumes diff --git a/lib/fog/hp/requests/block_storage/delete_volume.rb b/lib/fog/hp/requests/block_storage/delete_volume.rb new file mode 100644 index 000000000..058614f73 --- /dev/null +++ b/lib/fog/hp/requests/block_storage/delete_volume.rb @@ -0,0 +1,37 @@ +module Fog + module BlockStorage + class HP + class Real + + # Delete an existing block storage volume + # + # ==== Parameters + # * volume_id<~Integer> - Id of the volume to delete + # + def delete_volume(volume_id) + response = request( + :expects => 202, + :method => 'DELETE', + :path => "os-volumes/#{volume_id}" + ) + response + end + + end + + class Mock # :nodoc:all + + def delete_volume(volume_id) + response = Excon::Response.new + if volume = self.data[:volumes][volume_id] + response.status = 202 + else + raise Fog::BlockStorage::HP::NotFound + end + response + end + end + + end + end +end \ No newline at end of file