incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r964400 - in /incubator/deltacloud/trunk/server/lib: deltacloud/base_driver/base_driver.rb deltacloud/drivers/gogrid/gogrid_driver.rb drivers.rb sinatra/rabbit.rb
Date Thu, 15 Jul 2010 12:29:23 GMT
Author: mfojtik
Date: Thu Jul 15 12:29:22 2010
New Revision: 964400

URL: http://svn.apache.org/viewvc?rev=964400&view=rev
Log:
Added possibility to configure collections per driver

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/base_driver.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
    incubator/deltacloud/trunk/server/lib/drivers.rb
    incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/base_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/base_driver.rb?rev=964400&r1=964399&r2=964400&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/base_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/base_driver.rb Thu Jul 15
12:29:22 2010
@@ -185,6 +185,16 @@ module Deltacloud
         return collection.select{|e| filter == e.send(attribute) }
       end
     end
+
+    def supported_collections
+      DEFAULT_COLLECTIONS
+    end
+
+    def has_collection?(collection)
+      return true if self.supported_collections.include?(collection)
+      return false
+    end
+
   end
 
 end

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb?rev=964400&r1=964399&r2=964400&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/gogrid/gogrid_driver.rb Thu Jul
15 12:29:22 2010
@@ -43,6 +43,10 @@ class GogridDriver < Deltacloud::BaseDri
     storage        10
   end
 
+  def supported_collections
+    DEFAULT_COLLECTIONS.reject { |c| [ :storage_volumes, :storage_snapshots ].include?(c)
}
+  end
+
   # The only valid option for flavors is server RAM for now
   def flavors(credentials, opts=nil)
     flavors = []

Modified: incubator/deltacloud/trunk/server/lib/drivers.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/drivers.rb?rev=964400&r1=964399&r2=964400&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/drivers.rb (original)
+++ incubator/deltacloud/trunk/server/lib/drivers.rb Thu Jul 15 12:29:22 2010
@@ -9,6 +9,16 @@ DRIVERS = {
   :mock => { :name => "Mock" }
 }
 
+DEFAULT_COLLECTIONS = [
+  :hardware_profiles,
+  :images,
+  :instances,
+  :instance_states,
+  :realms,
+  :storage_volumes,
+  :storage_snapshots
+]
+
 DRIVER=ENV['API_DRIVER'] ? ENV['API_DRIVER'].to_sym : :mock
 
 def driver_name

Modified: incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb?rev=964400&r1=964399&r2=964400&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb Thu Jul 15 12:29:22 2010
@@ -203,6 +203,7 @@ module Sinatra
     # operation on this collection.
     def collection(name, &block)
       raise DuplicateCollectionException if collections[name]
+      return unless driver.has_collection?(name.to_sym)
       collections[name] = Collection.new(name, &block)
       collections[name].add_feature_params(driver.features(name))
       collections[name].generate



Mime
View raw message