deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] VSphere: Added support for StoragePod
Date Thu, 06 Dec 2012 12:30:01 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/drivers/vsphere/vsphere_client.rb | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb b/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
index 1d158f8..acda255 100644
--- a/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
+++ b/server/lib/deltacloud/drivers/vsphere/vsphere_client.rb
@@ -97,10 +97,15 @@ module Deltacloud::Drivers::VSphere
       rootFolder = vsphere.serviceInstance.content.rootFolder
       rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|
         list_datastores(dc.datastoreFolder).each do  |datastore|
-          vms += datastore.vm.collect { |vm| { :instance => vm, :datastore => datastore.name
} unless vm.nil? }
-          stored_tasks(datastore, vsphere) do |task|
-            if task.info.entity.class == RbVmomi::VIM::VirtualMachine
-              vms << { :stored_instance => load_serialized_instance(datastore, task.info.key),
:datastore => datastore.name }
+          if datastore.class == RbVmomi::VIM::StoragePod
+            storagepod_name = datastore.summary['name']
+            vms += datastore.childEntity.grep(RbVmomi::VIM::VirtualMachine).collect { |vm|
{ :instance => vm, :datastore => storagepod_name } }
+          else
+            vms += datastore.vm.collect { |vm| { :instance => vm, :datastore => datastore.name
} unless vm.nil? }
+            stored_tasks(datastore, vsphere) do |task|
+              if task.info.entity.class == RbVmomi::VIM::VirtualMachine
+                vms << { :stored_instance => load_serialized_instance(datastore,
task.info.key), :datastore => datastore.name }
+              end
             end
           end
         end
@@ -116,6 +121,8 @@ module Deltacloud::Drivers::VSphere
       df.childEntity.each do |object|
         if object.class.to_s == 'Folder'
           datastores += list_datastores(object)
+        elsif object.class.to_s == 'StoragePod'
+          datastores += list_datastores(object)
         else
           datastores << object
         end
-- 
1.8.0.1


Mime
View raw message