deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 1/3] Adds storage_volume create/delete to mock driver
Date Tue, 13 Dec 2011 14:24:35 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/drivers/mock/mock_driver.rb |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb
index 9a79671..5d07eed 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
@@ -245,6 +245,25 @@ module Deltacloud::Drivers::Mock
       volumes
     end
 
+    def create_storage_volume(credentials, opts=nil)
+      check_credentials(credentials)
+      opts ||= {}
+      opts[:capacity] ||= "1"
+      volume = {
+            :id => "Volume#{Time.now.to_i}",
+            :created => Time.now.to_s,
+            :state => "AVAILABLE",
+            :capacity => opts[:capacity],
+      }
+      @client.store(:storage_volumes, volume)
+      StorageVolume.new(volume)
+    end
+
+    def destroy_storage_volume(credentials, opts=nil)
+      check_credentials(credentials)
+      @client.destroy(:storage_volumes, opts[:id])
+    end
+
     #
     # Storage Snapshots
     #
-- 
1.7.6.4


Mime
View raw message