mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Cleanup VMS when leaving
This commit is contained in:
1 parent
e12e6044dc
commit
08b2dc6369
4 files changed
+21
-10
No files matched your search
@@ -49,6 +49,13 @@ class BaseManager:
|
||||
cls._instance = cls()
|
||||
return cls._instance
|
||||
|
||||
def __del__(self):
|
||||
self.destroy()
|
||||
|
||||
def destroy():
|
||||
"""Cleanup the VMS. Call this before closing the server"""
|
||||
cls._instance()
|
||||
|
||||
@property
|
||||
def module_name(self):
|
||||
"""
|
||||
|
||||
@@ -32,7 +32,8 @@ class BaseVM:
|
||||
name=self.name,
|
||||
uuid=self.uuid))
|
||||
|
||||
# TODO: When delete release console ports
|
||||
def __del__(self):
|
||||
self.destroy()
|
||||
|
||||
@property
|
||||
def project(self):
|
||||
@@ -118,3 +119,10 @@ class BaseVM:
|
||||
"""
|
||||
|
||||
raise NotImplementedError
|
||||
|
||||
def destroy(self):
|
||||
"""
|
||||
Destroy the VM process.
|
||||
"""
|
||||
|
||||
raise NotImplementedError
|
||||
@@ -81,9 +81,6 @@ class VPCSVM(BaseVM):
|
||||
else:
|
||||
self._console = self._manager.port_manager.get_free_console_port()
|
||||
|
||||
def __del__(self):
|
||||
self.destroy()
|
||||
|
||||
def destroy(self):
|
||||
self._kill_process()
|
||||
if self._console:
|
||||
|
||||
Reference in new issue
Block a user