mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
parent
4815904737
commit
59dcdcc141
@ -93,9 +93,13 @@ class GNS3VM:
|
|||||||
remote_informations
|
remote_informations
|
||||||
]
|
]
|
||||||
|
|
||||||
def _current_engine(self):
|
def current_engine(self):
|
||||||
return self._get_engine(self._settings["engine"])
|
return self._get_engine(self._settings["engine"])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def engine(self):
|
||||||
|
return self._settings["engine"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip_address(self):
|
def ip_address(self):
|
||||||
"""
|
"""
|
||||||
@ -103,7 +107,7 @@ class GNS3VM:
|
|||||||
|
|
||||||
:returns: VM IP address
|
:returns: VM IP address
|
||||||
"""
|
"""
|
||||||
return self._current_engine().ip_address
|
return self.current_engine().ip_address
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def running(self):
|
def running(self):
|
||||||
@ -112,7 +116,7 @@ class GNS3VM:
|
|||||||
|
|
||||||
:returns: Boolean
|
:returns: Boolean
|
||||||
"""
|
"""
|
||||||
return self._current_engine().running
|
return self.current_engine().running
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user(self):
|
def user(self):
|
||||||
@ -121,7 +125,7 @@ class GNS3VM:
|
|||||||
|
|
||||||
:returns: VM user
|
:returns: VM user
|
||||||
"""
|
"""
|
||||||
return self._current_engine().user
|
return self.current_engine().user
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def password(self):
|
def password(self):
|
||||||
@ -130,7 +134,7 @@ class GNS3VM:
|
|||||||
|
|
||||||
:returns: VM password
|
:returns: VM password
|
||||||
"""
|
"""
|
||||||
return self._current_engine().password
|
return self.current_engine().password
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def port(self):
|
def port(self):
|
||||||
@ -139,7 +143,7 @@ class GNS3VM:
|
|||||||
|
|
||||||
:returns: VM port
|
:returns: VM port
|
||||||
"""
|
"""
|
||||||
return self._current_engine().port
|
return self.current_engine().port
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def protocol(self):
|
def protocol(self):
|
||||||
@ -148,7 +152,7 @@ class GNS3VM:
|
|||||||
|
|
||||||
:returns: VM protocol
|
:returns: VM protocol
|
||||||
"""
|
"""
|
||||||
return self._current_engine().protocol
|
return self.current_engine().protocol
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def enable(self):
|
def enable(self):
|
||||||
@ -187,7 +191,7 @@ class GNS3VM:
|
|||||||
yield from self.start()
|
yield from self.start()
|
||||||
else:
|
else:
|
||||||
# When user fix something on his system and try again
|
# When user fix something on his system and try again
|
||||||
if not self._current_engine().running and self.enable:
|
if not self.current_engine().running and self.enable:
|
||||||
yield from self.start()
|
yield from self.start()
|
||||||
|
|
||||||
def _get_engine(self, engine):
|
def _get_engine(self, engine):
|
||||||
@ -233,7 +237,7 @@ class GNS3VM:
|
|||||||
except GNS3VMError as e:
|
except GNS3VMError as e:
|
||||||
# User will receive the error later when they will try to use the node
|
# User will receive the error later when they will try to use the node
|
||||||
yield from self._controller.add_compute(compute_id="vm",
|
yield from self._controller.add_compute(compute_id="vm",
|
||||||
name="GNS3 VM ({})".format(self._current_engine().vmname),
|
name="GNS3 VM ({})".format(self.current_engine().vmname),
|
||||||
host=None,
|
host=None,
|
||||||
force=True)
|
force=True)
|
||||||
|
|
||||||
@ -253,7 +257,7 @@ class GNS3VM:
|
|||||||
"""
|
"""
|
||||||
Start the GNS3 VM
|
Start the GNS3 VM
|
||||||
"""
|
"""
|
||||||
engine = self._current_engine()
|
engine = self.current_engine()
|
||||||
if not engine.running:
|
if not engine.running:
|
||||||
log.info("Start the GNS3 VM")
|
log.info("Start the GNS3 VM")
|
||||||
engine.vmname = self._settings["vmname"]
|
engine.vmname = self._settings["vmname"]
|
||||||
@ -274,7 +278,7 @@ class GNS3VM:
|
|||||||
"""
|
"""
|
||||||
Suspend the GNS3 VM
|
Suspend the GNS3 VM
|
||||||
"""
|
"""
|
||||||
engine = self._current_engine()
|
engine = self.current_engine()
|
||||||
if "vm" in self._controller.computes:
|
if "vm" in self._controller.computes:
|
||||||
yield from self._controller.delete_compute("vm")
|
yield from self._controller.delete_compute("vm")
|
||||||
if engine.running:
|
if engine.running:
|
||||||
@ -286,7 +290,7 @@ class GNS3VM:
|
|||||||
"""
|
"""
|
||||||
Stop the GNS3 VM
|
Stop the GNS3 VM
|
||||||
"""
|
"""
|
||||||
engine = self._current_engine()
|
engine = self.current_engine()
|
||||||
if "vm" in self._controller.computes:
|
if "vm" in self._controller.computes:
|
||||||
yield from self._controller.delete_compute("vm")
|
yield from self._controller.delete_compute("vm")
|
||||||
if engine.running:
|
if engine.running:
|
||||||
|
@ -39,6 +39,10 @@ class VMwareGNS3VM(BaseGNS3VM):
|
|||||||
self._vmware_manager = VMware()
|
self._vmware_manager = VMware()
|
||||||
self._vmx_path = None
|
self._vmx_path = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def vmx_path(self):
|
||||||
|
return self._vmx_path
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _execute(self, subcommand, args, timeout=60):
|
def _execute(self, subcommand, args, timeout=60):
|
||||||
|
|
||||||
|
@ -136,6 +136,16 @@ class ServerHandler:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
# If something is wrong we log the info to the log and we hope the log will be include correctly to the debug export
|
# If something is wrong we log the info to the log and we hope the log will be include correctly to the debug export
|
||||||
log.error("Could not export debug informations {}".format(e), exc_info=1)
|
log.error("Could not export debug informations {}".format(e), exc_info=1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
if Controller.instance().gns3vm.engine == "vmware":
|
||||||
|
vmx_path = Controller.instance().gns3vm.current_engine().vmx_path
|
||||||
|
if vmx_path:
|
||||||
|
shutil.copy(vmx_path, os.path.join(debug_dir, os.path.basename(vmx_path)))
|
||||||
|
except OSError as e:
|
||||||
|
# If something is wrong we log the info to the log and we hope the log will be include correctly to the debug export
|
||||||
|
log.error("Could not copy VMware VMX file {}".format(e), exc_info=1)
|
||||||
|
|
||||||
response.set_status(201)
|
response.set_status(201)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user