deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [18/50] [abbrv] git commit: Core: Advertise the hardware_profiles only if driver support them.
Date Tue, 22 May 2012 20:19:37 GMT
Core: Advertise the hardware_profiles only if driver support them.


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

Branch: refs/heads/master
Commit: 2abcab5d5774312c10df7e89948a081ad1959494
Parents: 8b09944
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu May 17 13:22:23 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue May 22 22:17:38 2012 +0200

----------------------------------------------------------------------
 .../deltacloud/collections/hardware_profiles.rb    |    6 ++++--
 .../drivers/opennebula/opennebula_driver.rb        |    2 ++
 .../drivers/openstack/openstack_driver.rb          |    2 ++
 .../drivers/rackspace/rackspace_driver.rb          |    6 ++++--
 .../deltacloud/drivers/vsphere/vsphere_driver.rb   |    2 ++
 server/lib/deltacloud/helpers/rabbit_helper.rb     |    8 ++++----
 6 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2abcab5d/server/lib/deltacloud/collections/hardware_profiles.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/collections/hardware_profiles.rb b/server/lib/deltacloud/collections/hardware_profiles.rb
index ff01d4a..5c72aff 100644
--- a/server/lib/deltacloud/collections/hardware_profiles.rb
+++ b/server/lib/deltacloud/collections/hardware_profiles.rb
@@ -16,10 +16,12 @@
 module Deltacloud::Collections
   class HardwareProfiles < Base
 
+    check_capability :for => lambda { |m| !driver.class.send(m).empty? }
+
     collection :hardware_profiles do
 
-      standard_index_operation
-      standard_show_operation
+      standard_index_operation :capability => :hardware_profiles
+      standard_show_operation :capability => :hardware_profiles
 
     end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2abcab5d/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb b/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
index 2c6203b..cc1f13e 100644
--- a/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
+++ b/server/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
@@ -27,6 +27,8 @@ module Deltacloud
 
 class OpennebulaDriver < Deltacloud::BaseDriver
 
+  define_hardware_profile('default')
+
   ######################################################################
   # Hardware profiles
   #####################################################################

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2abcab5d/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
index 12dadef..0ed2baf 100644
--- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
+++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
@@ -36,6 +36,8 @@ module Deltacloud
           stopped.to( :finish )         .automatically
         end
 
+        define_hardware_profile('default')
+
         def hardware_profiles(credentials, opts = {})
           os = new_client(credentials)
           results = []

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2abcab5d/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
index c8030ad..ca1c236 100644
--- a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
+++ b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
@@ -29,6 +29,8 @@ class RackspaceDriver < Deltacloud::BaseDriver
   feature :instances, :user_files
   feature :images, :user_name
 
+  define_hardware_profile('default')
+
   def hardware_profiles(credentials, opts = {})
     rs = new_client( credentials )
     results = []
@@ -189,8 +191,8 @@ class RackspaceDriver < Deltacloud::BaseDriver
     start.to( :pending )          .on( :create )
     pending.to( :running )        .automatically
     running.to( :running )        .on( :reboot )
-    running.to( :shutting_down )  .on( :stop )
-    shutting_down.to( :stopped )  .automatically
+    running.to( :stopping )  .on( :stop )
+    stopping.to( :stopped )  .automatically
     stopped.to( :finish )         .automatically
   end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2abcab5d/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
index a6a1e58..6d30cd4 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
@@ -33,6 +33,8 @@ module Deltacloud::Drivers::Vsphere
     feature :instances, :user_data
     feature :instances, :user_name
 
+    define_hardware_profile('default')
+
     # There is just one hardware profile where memory is measured using maximum
     # memory available on ESX for virtual machines and CPU using maximum free
     # CPU cores in ESX.

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2abcab5d/server/lib/deltacloud/helpers/rabbit_helper.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/helpers/rabbit_helper.rb b/server/lib/deltacloud/helpers/rabbit_helper.rb
index 252abe2..d6a472a 100644
--- a/server/lib/deltacloud/helpers/rabbit_helper.rb
+++ b/server/lib/deltacloud/helpers/rabbit_helper.rb
@@ -16,16 +16,16 @@
 
 Sinatra::Rabbit::Collection.class_eval do
 
-  def self.standard_index_operation
+  def self.standard_index_operation(opts={})
     collection_name = @collection_name
-    operation :index, :with_capability => collection_name do
+    operation :index, :with_capability => opts[:capability] || collection_name do
       control { filter_all collection_name }
     end
   end
 
-  def self.standard_show_operation
+  def self.standard_show_operation(opts={})
     collection_name = @collection_name
-    operation :show, :with_capability => collection_name do
+    operation :show, :with_capability => opts[:capability] || collection_name do
       control { show collection_name.to_s.singularize.intern }
     end
   end


Mime
View raw message