From cc9b575b775bd6006a7adfcb41c2e83147df50a3 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 16 Mar 2015 12:45:21 -0600 Subject: [PATCH] Bind UDP tunnels to the correct source address. Fixes #96. --- gns3server/handlers/api/qemu_handler.py | 7 ++----- gns3server/modules/qemu/qemu_vm.py | 11 ++++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gns3server/handlers/api/qemu_handler.py b/gns3server/handlers/api/qemu_handler.py index 20f72e33..659d1b03 100644 --- a/gns3server/handlers/api/qemu_handler.py +++ b/gns3server/handlers/api/qemu_handler.py @@ -15,9 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os - - from ...web.route import Route from ...schemas.qemu import QEMU_CREATE_SCHEMA from ...schemas.qemu import QEMU_UPDATE_SCHEMA @@ -55,8 +52,8 @@ class QEMUHandler: request.json.get("vm_id"), qemu_path=request.json.get("qemu_path"), console=request.json.get("console"), - monitor=request.json.get("monitor"), - ) + monitor=request.json.get("monitor")) + # Clear already used keys map(request.json.__delitem__, ["name", "project_id", "vm_id", "qemu_path", "console", "monitor"]) diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index 2c34e8a6..e595110f 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -49,11 +49,9 @@ class QemuVM(BaseVM): :param manager: parent VM Manager :param console: TCP console port :param qemu_path: path to the QEMU binary - :param host: host/address to bind for console and UDP connections :param qemu_id: QEMU VM instance ID :param console: TCP console port :param monitor: TCP monitor port - :param monitor_host: IP address to bind for monitor connections """ def __init__(self, @@ -62,20 +60,19 @@ class QemuVM(BaseVM): project, manager, qemu_path=None, - host="127.0.0.1", console=None, - monitor=None, - monitor_host="127.0.0.1"): + monitor=None): super().__init__(name, vm_id, project, manager, console=console) - self._host = host + server_config = manager.config.get_section_config("Server") + self._host = server_config.get("host", "127.0.0.1") + self._monitor_host = server_config.get("monitor_host", "127.0.0.1") self._command = [] self._started = False self._process = None self._cpulimit_process = None self._stdout_file = "" - self._monitor_host = monitor_host # QEMU settings self._qemu_path = qemu_path