deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1207874 - /deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb
Date Tue, 29 Nov 2011 13:33:26 GMT
Author: marios
Date: Tue Nov 29 13:33:26 2011
New Revision: 1207874

URL: http://svn.apache.org/viewvc?rev=1207874&view=rev
Log:
Adds find&conversion methods to CIMI::VolumeConfiguration model

Modified:
    deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb

Modified: deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb?rev=1207874&r1=1207873&r2=1207874&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb Tue Nov 29 13:33:26 2011
@@ -24,4 +24,36 @@ class CIMI::Model::VolumeConfiguration <
   array :operations do
     scalar :rel, :href
   end
+
+  def self.find(id, context)
+    volume_configs = []
+    if id == :all
+      #ec2 ebs volumes can 1gb..1tb
+      (1..1000).each do |size|
+        volume_configs << create(size, context)
+      end
+    else
+      volume_configs << create(id, context)
+      return volume_configs.first
+    end
+    return volume_configs
+  end
+
+
+  def self.all(context); find(:all, context); end
+
+  private
+
+  def self.create(size, context)
+    self.new( {
+                :uri => context.machine_configuration_url(size),
+                :name => size,
+                :description => "volume configuration with #{size} GiB",
+                :created => Time.now.to_s,
+                :capacity => {:quantity=>size, :units=>"gibibytes"},
+                :supports_snapshots => "true"
+                # FIXME :guest_interface => "NFS"
+            } )
+  end
+
 end



Mime
View raw message