mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Move code for exposing VM ip to the VM itself. And display VM starting status
Fix #1621
This commit is contained in:
3 files changed
+19
-39
No files matched your search
@@ -84,13 +84,10 @@ class Compute:
|
||||
self._id = compute_id
|
||||
|
||||
self.protocol = protocol
|
||||
self._console_host = console_host
|
||||
self.host = host
|
||||
self.port = port
|
||||
self._user = None
|
||||
if console_host is None:
|
||||
self._console_host = host
|
||||
else:
|
||||
self._console_host = console_host
|
||||
self._password = None
|
||||
self._connected = False
|
||||
self._closed = False # Close mean we are destroying the compute node
|
||||
@@ -217,6 +214,8 @@ class Compute:
|
||||
@host.setter
|
||||
def host(self, host):
|
||||
self._host = host
|
||||
if self._console_host is None:
|
||||
self._console_host = host
|
||||
|
||||
@property
|
||||
def console_host(self):
|
||||
|
||||
@@ -263,15 +263,22 @@ class GNS3VM:
|
||||
engine.vmname = self._settings["vmname"]
|
||||
engine.ram = self._settings["ram"]
|
||||
engine.vpcus = self._settings["vcpus"]
|
||||
yield from engine.start()
|
||||
yield from self._controller.add_compute(compute_id="vm",
|
||||
name="GNS3 VM ({})".format(engine.vmname),
|
||||
protocol=self.protocol,
|
||||
host=self.ip_address,
|
||||
port=self.port,
|
||||
user=self.user,
|
||||
password=self.password,
|
||||
force=True)
|
||||
compute = yield from self._controller.add_compute(compute_id="vm",
|
||||
name="GNS3 VM is starting ({})".format(engine.vmname),
|
||||
host=None,
|
||||
force=True)
|
||||
|
||||
try:
|
||||
yield from engine.start()
|
||||
except Exception as e:
|
||||
yield from self._controller.delete_compute("vm")
|
||||
raise e
|
||||
yield from compute.update(name="GNS3 VM ({})".format(engine.vmname),
|
||||
protocol=self.protocol,
|
||||
host=self.ip_address,
|
||||
port=self.port,
|
||||
user=self.user,
|
||||
password=self.password)
|
||||
|
||||
@locked_coroutine
|
||||
def _suspend(self):
|
||||
|
||||
Reference in new issue
Block a user