incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1159185 - in /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm: rhevm_client.rb rhevm_driver.rb
Date Thu, 18 Aug 2011 12:05:26 GMT
Author: mfojtik
Date: Thu Aug 18 12:05:26 2011
New Revision: 1159185

URL: http://svn.apache.org/viewvc?rev=1159185&view=rev
Log:
Add has_datacenter? method for datacenter existence in cluster object creation

Signed-off-by: Francesco Vollero <fvollero@redhat.com>

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb?rev=1159185&r1=1159184&r2=1159185&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb Thu Aug
18 12:05:26 2011
@@ -131,8 +131,8 @@ module RHEVM
         [ RHEVM::Cluster::new(self, vm)]
       else
         Client::parse_response(RHEVM::client(@api_entrypoint)["/clusters"].get(headers)).xpath('/clusters/cluster').collect
do |vm|
-          RHEVM::Cluster::new(self, vm)
-        end
+          RHEVM::Cluster::new(self, vm) if has_datacenter?(vm)
+        end.compact
       end
     end
 
@@ -196,6 +196,10 @@ module RHEVM
       Nokogiri::XML(response)
     end
 
+    def has_datacenter?(vm)
+      value=!(vm/'data_center').empty?
+      value
+    end
   end
 
   class BaseObject
@@ -300,6 +304,7 @@ module RHEVM
       @description = ((xml/'description').first.text rescue nil)
       @datacenter = Link::new(@client, (xml/'data_center').first[:id], (xml/'data_center').first[:href])
     end
+
   end
 
   class DataCenter < BaseObject

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb?rev=1159185&r1=1159184&r2=1159185&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb Thu Aug
18 12:05:26 2011
@@ -78,6 +78,7 @@ class RHEVMDriver < Deltacloud::BaseDriv
     realm_arr = []
     safely do
       clusters = client.clusters
+      puts clusters.size
       clusters.each do |r|
         d = client.datacenters(:id => r.datacenter.id).first
         realm_arr << convert_realm(r, d)



Mime
View raw message