mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-11 16:41:04 +00:00
Should fix ProcessLookupError exceptions.
This commit is contained in:
parent
1610067eee
commit
223f3ee705
@ -494,12 +494,12 @@ class Dynamips(BaseManager):
|
||||
yield from vm.set_sparsemem(False)
|
||||
|
||||
# update the configs if needed
|
||||
yield from self.create_vm_configs(vm, settings)
|
||||
yield from self.set_vm_configs(vm, settings)
|
||||
|
||||
@asyncio.coroutine
|
||||
def create_vm_configs(self, vm, settings):
|
||||
def set_vm_configs(self, vm, settings):
|
||||
"""
|
||||
Creates VM configs from pushed content.
|
||||
Set VM configs from pushed content or existing config files.
|
||||
|
||||
:param vm: VM instance
|
||||
:param settings: VM settings
|
||||
@ -514,7 +514,8 @@ class Dynamips(BaseManager):
|
||||
startup_config_path = self._create_config(vm, startup_config_content, default_startup_config_path)
|
||||
yield from vm.set_configs(startup_config_path)
|
||||
else:
|
||||
startup_config_path = settings.get("startup_config", "")
|
||||
startup_config_path = settings.get("startup_config")
|
||||
if startup_config_path:
|
||||
yield from vm.set_configs(startup_config_path)
|
||||
|
||||
private_config_content = settings.get("private_config_content")
|
||||
@ -522,7 +523,8 @@ class Dynamips(BaseManager):
|
||||
private_config_path = self._create_config(vm, private_config_content, default_private_config_path)
|
||||
yield from vm.set_configs(vm.startup_config, private_config_path)
|
||||
else:
|
||||
private_config_path = settings.get("private_config", "")
|
||||
private_config_path = settings.get("private_config")
|
||||
if private_config_path:
|
||||
yield from vm.set_configs(vm.startup_config, private_config_path)
|
||||
|
||||
def _create_config(self, vm, content, path):
|
||||
|
@ -138,9 +138,9 @@ class Hypervisor(DynamipsHypervisor):
|
||||
try:
|
||||
yield from asyncio.wait_for(self._process.wait(), timeout=3)
|
||||
except asyncio.TimeoutError:
|
||||
self._process.kill()
|
||||
if self._process.returncode is None:
|
||||
log.warn("Dynamips process {} is still running".format(self._process.pid))
|
||||
log.warn("Dynamips process {} is still running... killing it".format(self._process.pid))
|
||||
self._process.kill()
|
||||
|
||||
if self._stdout_file and os.access(self._stdout_file, os.W_OK):
|
||||
try:
|
||||
|
@ -1249,6 +1249,8 @@ class Router(BaseVM):
|
||||
port_number=port_number))
|
||||
|
||||
nio = adapter.get_nio(port_number)
|
||||
if nio is None:
|
||||
return
|
||||
if isinstance(nio, NIOUDP):
|
||||
self.manager.port_manager.release_udp_port(nio.lport)
|
||||
adapter.remove_nio(port_number)
|
||||
|
@ -488,9 +488,10 @@ class IOUVM(BaseVM):
|
||||
try:
|
||||
yield from gns3server.utils.asyncio.wait_for_process_termination(self._iou_process, timeout=3)
|
||||
except asyncio.TimeoutError:
|
||||
self._iou_process.kill()
|
||||
if self._iou_process.returncode is None:
|
||||
log.warn("IOU process {} is still running".format(self._iou_process.pid))
|
||||
log.warn("IOU process {} is still running... killing it".format(self._iou_process.pid))
|
||||
self._iou_process.kill()
|
||||
|
||||
self._iou_process = None
|
||||
|
||||
if self._iouyap_process is not None:
|
||||
@ -498,11 +499,11 @@ class IOUVM(BaseVM):
|
||||
try:
|
||||
yield from gns3server.utils.asyncio.wait_for_process_termination(self._iouyap_process, timeout=3)
|
||||
except asyncio.TimeoutError:
|
||||
self._iouyap_process.kill()
|
||||
if self._iouyap_process.returncode is None:
|
||||
log.warn("IOUYAP process {} is still running".format(self._iouyap_process.pid))
|
||||
self._iouyap_process = None
|
||||
log.warn("IOUYAP process {} is still running... killing it".format(self._iouyap_process.pid))
|
||||
self._iouyap_process.kill()
|
||||
|
||||
self._iouyap_process = None
|
||||
self._started = False
|
||||
|
||||
def _terminate_process_iouyap(self):
|
||||
|
@ -245,9 +245,9 @@ class VPCSVM(BaseVM):
|
||||
try:
|
||||
yield from asyncio.wait_for(self._process.wait(), timeout=3)
|
||||
except asyncio.TimeoutError:
|
||||
self._process.kill()
|
||||
if self._process.returncode is None:
|
||||
log.warn("VPCS process {} is still running".format(self._process.pid))
|
||||
log.warn("VPCS process {} is still running... killing it".format(self._process.pid))
|
||||
self._process.kill()
|
||||
|
||||
self._process = None
|
||||
self._started = False
|
||||
|
Loading…
Reference in New Issue
Block a user