commit 8d64569064ff132cc8ced0edd6df35d111909005
Author: Radek Novacek <rnovacek(a)redhat.com>
Date: Fri Jan 3 09:05:47 2014 +0100
vsphere: create connection to vsphere each time
The connection to the vsphere tends to timeout when not used for some
time. The login will fail after that. This commit forces virt-who to reconnect
to vsphere each time.
(cherry picked from commit 08c5db906c333a2a47e060af42c85df95c13d513)
vsphere.py | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/vsphere.py b/vsphere.py
index 8183a67..5fbede2 100644
--- a/vsphere.py
+++ b/vsphere.py
@@ -115,6 +115,16 @@ class VSphere:
if not "://" in self.url:
self.url = "https://%s" % self.url
+ self.clusters = {}
+ self.hosts = {}
+ self.vms = {}
+
+ def scan(self):
+ """
+ Scan method does full inventory traversal on the vCenter machine. It finds
+ all ComputeResources, Hosts and VirtualMachines.
+ """
+
# Connect to the vCenter server
self.client = suds.client.Client("%s/sdk/vimService.wsdl" % self.url)
@@ -127,16 +137,6 @@ class VSphere:
# Service Content object defines properties of the ServiceInstance object
self.sc = self.client.service.RetrieveServiceContent(_this=self.moRef)
- self.clusters = {}
- self.hosts = {}
- self.vms = {}
-
- def scan(self):
- """
- Scan method does full inventory traversal on the vCenter machine. It finds
- all ComputeResources, Hosts and VirtualMachines.
- """
-
# Login to server using given credentials
self.client.service.Login(_this=self.sc.sessionManager, userName=self.username,
password=self.password)
Show replies by date