FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-05-2012, 03:38 PM
"Marek 'marx' Grac"
 
Default fence_vmware_soap: Support for 100+ VM in VMWare

In previous version, we did not try to get all results for VM. This
updated version fixes this issue by using proper SOAP API

Resolves: rhbz#735797
---
fence/agents/vmware_soap/fence_vmware_soap.py | 34 +++++++++++++++++--------
1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index f9344ff..9bebd08 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -39,6 +39,17 @@ def soap_login(options):
options["mo_SessionManager"] = mo_SessionManager
return conn

+def process_results(results, machines, uuid, mappingToUUID):
+ for m in results.objects:
+ info = {}
+ for i in m.propSet:
+ info[i.name] = i.val
+ machines[info["name"]] = (info["config.uuid"], info["summary.runtime.powerState"])
+ uuid[info["config.uuid"]] = info["summary.runtime.powerState"]
+ mappingToUUID[m.obj.value] = info["config.uuid"]
+
+ return (machines, uuid, mappingToUUID)
+
def get_power_status(conn, options):
mo_ViewManager = Property(options["ServiceContent"].viewManager.value)
mo_ViewManager._type = "ViewManager"
@@ -78,18 +89,19 @@ def get_power_status(conn, options):
except Exception, ex:
fail(EC_STATUS)

- machines = { }
- uuid = { }
- mappingToUUID = { }
+ (machines, uuid, mappingToUUID) = process_results(raw_machines, {}, {}, {})
+
+ # Probably need to loop over the ContinueRetreive if there are more results after 1 iteration.
+ while (hasattr(raw_machines, 'token') == True):
+ try:
+ raw_machines = conn.service.ContinueRetrievePropertiesEx(mo_Prope rtyCollector, raw_machines.token)
+ except Exception, ex:
+ fail(EC_STATUS)
+ (more_machines, more_uuid, more_mappingToUUID) = process_results(raw_machines, {}, {}, {})
+ machines.update(more_machines)
+ uuid.update(more_uuid)
+ mappingToUUID.update(more_mappingToUUID)

- for m in raw_machines.objects:
- info = {}
- for i in m.propSet:
- info[i.name] = i.val
- machines[info["name"]] = (info["config.uuid"], info["summary.runtime.powerState"])
- uuid[info["config.uuid"]] = info["summary.runtime.powerState"]
- mappingToUUID[m.obj.value] = info["config.uuid"]
-
if ["list", "monitor"].count(options["-o"]) == 1:
return machines
else:
--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 05:00 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org