Merge pull request #31780 from gtmanfred/2015.8

use already created vsphere connection
This commit is contained in:
Nicole Thomas 2016-03-10 10:41:53 -07:00
commit d6f669623c

View File

@ -86,7 +86,7 @@ import salt.utils
# Import Third Party Libs
try:
from pyVim.connect import SmartConnect, Disconnect
from pyVim.connect import GetSi, SmartConnect, Disconnect
from pyVmomi import vim, vmodl
HAS_PYVMOMI = True
except ImportError:
@ -184,6 +184,13 @@ def get_service_instance(host, username, password, protocol=None, port=None):
if port is None:
port = 443
service_instance = GetSi()
if service_instance:
if service_instance._GetStub().host == ':'.join([host, str(port)]):
service_instance._GetStub().GetConnection()
return service_instance
Disconnect(service_instance)
try:
service_instance = SmartConnect(
host=host,