mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Try a different method in order to retrieve IP from VMware
Ref https://github.com/GNS3/gns3-gui/issues/1589
This commit is contained in:
2 files changed
+41
-1
No files matched your search
@@ -128,8 +128,21 @@ class VMwareGNS3VM(BaseGNS3VM):
|
||||
args.extend(["nogui"])
|
||||
yield from self._execute("start", args)
|
||||
log.info("GNS3 VM has been started")
|
||||
|
||||
# get the guest IP address (first adapter only)
|
||||
guest_ip_address = yield from self._execute("getGuestIPAddress", [self._vmx_path, "-wait"], timeout=120)
|
||||
trial = 120
|
||||
guest_ip_address = ""
|
||||
while True:
|
||||
guest_ip_address = yield from self._execute("readVariable", [self._vmx_path, "guestVar", "gns3.eth0"], timeout=120)
|
||||
guest_ip_address = guest_ip_address.strip()
|
||||
if len(guest_ip_address) != 0:
|
||||
break
|
||||
trial -= 1
|
||||
# If ip not found fallback on old method
|
||||
if trial == 0:
|
||||
guest_ip_address = yield from self._execute("getGuestIPAddress", [self._vmx_path, "-wait"], timeout=120)
|
||||
break
|
||||
yield from asyncio.sleep(1)
|
||||
self.ip_address = guest_ip_address
|
||||
log.info("GNS3 VM IP address set to {}".format(guest_ip_address))
|
||||
self.running = True
|
||||
|
||||
Reference in new issue
Block a user