From a6286db7b187ac28f7d2a93d37525835f6860d09 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 7 Oct 2015 20:48:36 -0600 Subject: [PATCH] Release UDP ports when closing a Qemu VM. Fixes #323. --- gns3server/modules/qemu/qemu_vm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index 616b74dd..84baaccc 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -665,11 +665,19 @@ class QemuVM(BaseVM): """ log.debug('QEMU VM "{name}" [{id}] is closing'.format(name=self._name, id=self._id)) - yield from self.stop() + if self._console: self._manager.port_manager.release_tcp_port(self._console, self._project) self._console = None + for adapter in self._ethernet_adapters: + if adapter is not None: + for nio in adapter.ports.values(): + if nio and isinstance(nio, NIOUDP): + self.manager.port_manager.release_udp_port(nio.lport, self._project) + + yield from self.stop() + @asyncio.coroutine def _get_vm_status(self): """