1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

If a VMware command fail retry

Ref #1671
This commit is contained in:
Julien Duponchelle 2016-11-28 20:00:20 +01:00
parent 49315adf79
commit 433f620905
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -359,15 +359,21 @@ class VMware(BaseManager):
@asyncio.coroutine @asyncio.coroutine
def execute(self, subcommand, args, timeout=120, log_level=logging.INFO): def execute(self, subcommand, args, timeout=120, log_level=logging.INFO):
try: trial = 2
return (yield from self._execute(subcommand, args, timeout=timeout, log_level=log_level))
except VMwareError as e: while trial:
# We can fail to detect that it's VMware player instead of Workstation (due to marketing change Player is now Player Workstation) try:
if self.host_type == "ws" and "VIX_SERVICEPROVIDER_VMWARE_WORKSTATION" in str(e):
self._host_type = "player"
return (yield from self._execute(subcommand, args, timeout=timeout, log_level=log_level)) return (yield from self._execute(subcommand, args, timeout=timeout, log_level=log_level))
else: except VMwareError as e:
raise e # We can fail to detect that it's VMware player instead of Workstation (due to marketing change Player is now Player Workstation)
if self.host_type == "ws" and "VIX_SERVICEPROVIDER_VMWARE_WORKSTATION" in str(e):
self._host_type = "player"
return (yield from self._execute(subcommand, args, timeout=timeout, log_level=log_level))
else:
if trial <= 0:
raise e
trial -= 1
yield from asyncio.sleep(0.5)
@asyncio.coroutine @asyncio.coroutine
def _execute(self, subcommand, args, timeout=120, log_level=logging.INFO): def _execute(self, subcommand, args, timeout=120, log_level=logging.INFO):