You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2010/07/15 14:29:23 UTC
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
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