From 4075bbd70313596cb305e7b68ccb598ab5a478a1 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 8 Nov 2019 17:13:21 +0800 Subject: [PATCH] Fix exception when adding VirtualBox VM. Fixes #1685. --- gns3server/compute/virtualbox/virtualbox_vm.py | 2 ++ .../handlers/api/compute/virtualbox_handler.py | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gns3server/compute/virtualbox/virtualbox_vm.py b/gns3server/compute/virtualbox/virtualbox_vm.py index 6ee24439..77e3e676 100644 --- a/gns3server/compute/virtualbox/virtualbox_vm.py +++ b/gns3server/compute/virtualbox/virtualbox_vm.py @@ -205,6 +205,8 @@ class VirtualBoxVM(BaseNode): else: await self._refresh_vm_uuid() await self._create_linked_clone() + else: + await self._refresh_vm_uuid() if self._adapters: await self.set_adapters(self._adapters) diff --git a/gns3server/handlers/api/compute/virtualbox_handler.py b/gns3server/handlers/api/compute/virtualbox_handler.py index 6e63c9f5..366778e4 100644 --- a/gns3server/handlers/api/compute/virtualbox_handler.py +++ b/gns3server/handlers/api/compute/virtualbox_handler.py @@ -54,13 +54,13 @@ class VirtualBoxHandler: vbox_manager = VirtualBox.instance() vm = await vbox_manager.create_node(request.json.pop("name"), - request.match_info["project_id"], - request.json.get("node_id"), - request.json.pop("vmname"), - linked_clone=request.json.pop("linked_clone", False), - console=request.json.get("console", None), - console_type=request.json.get("console_type", "telnet"), - adapters=request.json.get("adapters", 0)) + request.match_info["project_id"], + request.json.get("node_id"), + request.json.pop("vmname"), + linked_clone=request.json.pop("linked_clone", False), + console=request.json.get("console", None), + console_type=request.json.get("console_type", "telnet"), + adapters=request.json.get("adapters", 0)) if "ram" in request.json: ram = request.json.pop("ram")