pyvmomi: vpshere connection connect.SmartConnect does not persist for longer than 15 min inactive time.

@tianhao64 , @hartsock

This issue is an offshoot of Issue #194 and #294 -----

My environment consists of a SAN attached to ESX host.

I am currently using pyvmomi 6.0 with Python 2.7.10 -

This is how am trying to connect to the vsphere web client (As per #294,)

import ssl
connect.SmartConnect(protocol="https",
host=self.fqdn,
user=self.username,
pwd=self.password,
sslContext=ssl._create_unverified_context())

the Test does below -

  1. Clone “x” VMs and power them on , in a sequence. “x” is passed as an argument to the test.
  2. Perform IO from each cloned VM to a common datastore provided to test as an argument.
  3. Take Snapshots of each clones
  4. Stop IO. ( this Step happens on the client host and vsphere is inactive for more than 15mins usually)
  5. Power off VMS and delete them

I am consistently hitting failure in Step 5 , while trying to power off the first Vm. Typical stack trace looks like this -

File “/home/usr/banalas/139895/testSW/lib/ClientHostVMware.py”, line 682, in vmPowerOff dlog.debug("Powering off " + virtualMachine.name) File “/home/usr/banalas/139895/testSW/lib/pyVmomi/VmomiSupport.py”, line 560, in call return self.f(args, *kwargs) File “/home/usr/banalas/139895/testSW/lib/pyVmomi/VmomiSupport.py”, line 383, in _InvokeAccessor return self._stub.InvokeAccessor(self, info) File “/home/usr/banalas/139895/testSW/lib/pyVmomi/StubAdapterAccessorImpl.py”, line 47, in InvokeAccessor raise objectContent.missingSet[0].fault vim.fault.NotAuthenticated: (vim.fault.NotAuthenticated) { dynamicType = , dynamicProperty = (vmodl.DynamicProperty) [], msg = ‘’, faultCause = , faultMessage = (vmodl.LocalizableMessage) [], object = ‘vim.VirtualMachine:vm-1050’, privilegeId = ‘System.View’

I ve also seen pyvmomi/SoapAdapter.py having CONNECTION_POOL_IDLE_TIMEOUT_SEC =900 secs which is 15 mins.

Is this the reason for my consistent failure? Can I try using a new connection to the vsphere before the power off task? How do I ensure the vsphere connection instance can be tolerant of idle timeouts > 15 mins and not hit vim.fault.NotAuthenticated.

Please suggest how to resolve this issue.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 32 (22 by maintainers)

Commits related to this issue

Most upvoted comments

Hi team, do you merge the fix to 6.5 version? I used the pyVmomi6.5 still the issue and found the timeout is 900s. CONNECTION_POOL_IDLE_TIMEOUT_SEC =900