mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Rename destroy to close or unload (more friendly).
This commit is contained in:
1 parent
2681defe27
commit
d9b02efbfa
7 files changed
+34
-13
No files matched your search
@@ -95,9 +95,9 @@ class BaseManager:
|
||||
return self._config
|
||||
|
||||
@classmethod
|
||||
@asyncio.coroutine # FIXME: why coroutine?
|
||||
def destroy(cls):
|
||||
def unload(cls):
|
||||
|
||||
# TODO: close explicitly all the VMs here?
|
||||
cls._instance = None
|
||||
|
||||
def get_vm(self, uuid):
|
||||
@@ -152,10 +152,10 @@ class BaseManager:
|
||||
"""
|
||||
|
||||
vm = self.get_vm(uuid)
|
||||
if asyncio.iscoroutinefunction(vm.destroy):
|
||||
yield from vm.destroy()
|
||||
if asyncio.iscoroutinefunction(vm.close):
|
||||
yield from vm.close()
|
||||
else:
|
||||
vm.destroy()
|
||||
vm.close()
|
||||
del self._vms[vm.uuid]
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -33,7 +33,8 @@ class BaseVM:
|
||||
uuid=self.uuid))
|
||||
|
||||
def __del__(self):
|
||||
self.destroy()
|
||||
|
||||
self.close()
|
||||
|
||||
@property
|
||||
def project(self):
|
||||
@@ -120,9 +121,9 @@ class BaseVM:
|
||||
|
||||
raise NotImplementedError
|
||||
|
||||
def destroy(self):
|
||||
def close(self):
|
||||
"""
|
||||
Destroy the VM process.
|
||||
Close the VM process.
|
||||
"""
|
||||
|
||||
raise NotImplementedError
|
||||
@@ -77,7 +77,8 @@ class VPCSVM(BaseVM):
|
||||
else:
|
||||
self._console = self._manager.port_manager.get_free_console_port()
|
||||
|
||||
def destroy(self):
|
||||
def close(self):
|
||||
|
||||
self._kill_process()
|
||||
if self._console:
|
||||
self._manager.port_manager.release_console_port(self._console)
|
||||
|
||||
Reference in new issue
Block a user