deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [3/54] git commit: CIMI: Show only supported collections in CEP
Date Mon, 20 Aug 2012 08:53:44 GMT
CIMI: Show only supported collections in CEP

* cloudEntryPoint will advertise *only* the supported collection.
  The decision whether the collection is supported or not is made based
  on presence of the required driver method in :with_capability.

* This also fix the problem when starting deltacloud using multiple
  frontends (DCLOUD-302)


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/eb557810
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/eb557810
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/eb557810

Branch: refs/heads/master
Commit: eb557810e1f9c476cb68117ebfbf0fbf80356d7b
Parents: 73b5c59
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Aug 16 11:56:50 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Aug 20 10:53:02 2012 +0200

----------------------------------------------------------------------
 server/lib/cimi/models/cloud_entry_point.rb |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/eb557810/server/lib/cimi/models/cloud_entry_point.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/cloud_entry_point.rb b/server/lib/cimi/models/cloud_entry_point.rb
index 9ec3446..52997e7 100644
--- a/server/lib/cimi/models/cloud_entry_point.rb
+++ b/server/lib/cimi/models/cloud_entry_point.rb
@@ -16,19 +16,11 @@
 class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
 
   text  :base_uri, :xml_name => "baseURI", :json_name => "baseURI"
+
   array :entity_metadata do
     scalar :href
   end
 
-  DELTACLOUD_MAPPINGS = { "MachineImages" => "images",
-                          "MachineConfigurations" => "hardware_profiles",
-                          "Machines" => "instances",
-                          "Volumes" => "storage_volumes",
-                          "MachineAdmins" => "keys",
-                          "VolumeImages" => "storage_snapshots",
-                        }
-
-
   def self.create(context)
     self.new(entities(context).merge({
       :name => context.driver.name,
@@ -42,12 +34,13 @@ class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
 
   # Return an Hash of the CIMI root entities used in CloudEntryPoint
   def self.entities(context)
-    CIMI::Model.root_entities.inject({}) do |result, entity|
-      if DELTACLOUD_MAPPINGS[entity]
-        next result unless context.driver.respond_to?(DELTACLOUD_MAPPINGS[entity])
+    CIMI::Collections.cimi_modules.inject({}) do |supported_entities, m|
+      m.collections.each do |c|
+        index_operation_capability = c.operation(:index).required_capability
+        next if m.settings.respond_to?(:capability) and !m.settings.capability(index_operation_capability)
+        supported_entities[c.collection_name.to_s] = { :href => context.send(:"#{c.collection_name}_url")
}
       end
-      result[entity.underscore] = { :href => context.send(:"#{entity.underscore}_url")
}
-      result
+      supported_entities
     end
   end
 


Mime
View raw message