mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #31780 from gtmanfred/2015.8
use already created vsphere connection
This commit is contained in:
commit
d6f669623c
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user