mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Fix switching console type from telnet to VNC throws error. Fixes #2489.
This commit is contained in:
parent
1905a99ce7
commit
40151cd1fe
@ -442,7 +442,7 @@ class BaseNode:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if self._console_type == "vnc" and console is not None and console < 5900:
|
if self._console_type == "vnc" and console is not None and console < 5900:
|
||||||
raise NodeError("VNC console require a port superior or equal to 5900 currently it's {}".format(console))
|
raise NodeError("VNC console require a port superior or equal to 5900, current port is {}".format(console))
|
||||||
|
|
||||||
if self._console:
|
if self._console:
|
||||||
self._manager.port_manager.release_tcp_port(self._console, self._project)
|
self._manager.port_manager.release_tcp_port(self._console, self._project)
|
||||||
|
@ -387,7 +387,7 @@ class Node:
|
|||||||
if prop not in self.CONTROLLER_ONLY_PROPERTIES:
|
if prop not in self.CONTROLLER_ONLY_PROPERTIES:
|
||||||
update_compute = True
|
update_compute = True
|
||||||
|
|
||||||
# We update properties on the compute and wait for the anwser from the compute node
|
# We update properties on the compute and wait for the answer from the compute node
|
||||||
if prop == "properties":
|
if prop == "properties":
|
||||||
compute_properties = kwargs[prop]
|
compute_properties = kwargs[prop]
|
||||||
else:
|
else:
|
||||||
|
@ -120,7 +120,8 @@ class QEMUHandler:
|
|||||||
|
|
||||||
qemu_manager = Qemu.instance()
|
qemu_manager = Qemu.instance()
|
||||||
vm = qemu_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
vm = qemu_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
|
# update the console first to avoid issue if updating console type
|
||||||
|
vm.console = request.json.pop("console", vm.console)
|
||||||
for name, value in request.json.items():
|
for name, value in request.json.items():
|
||||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||||
setattr(vm, name, value)
|
setattr(vm, name, value)
|
||||||
|
@ -138,6 +138,9 @@ class VirtualBoxHandler:
|
|||||||
if ram != vm.ram:
|
if ram != vm.ram:
|
||||||
yield from vm.set_ram(ram)
|
yield from vm.set_ram(ram)
|
||||||
|
|
||||||
|
# update the console first to avoid issue if updating console type
|
||||||
|
vm.console = request.json.pop("console", vm.console)
|
||||||
|
|
||||||
for name, value in request.json.items():
|
for name, value in request.json.items():
|
||||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||||
setattr(vm, name, value)
|
setattr(vm, name, value)
|
||||||
|
@ -106,7 +106,8 @@ class VMwareHandler:
|
|||||||
|
|
||||||
vmware_manager = VMware.instance()
|
vmware_manager = VMware.instance()
|
||||||
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
|
# update the console first to avoid issue if updating console type
|
||||||
|
vm.console = request.json.pop("console", vm.console)
|
||||||
for name, value in request.json.items():
|
for name, value in request.json.items():
|
||||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||||
setattr(vm, name, value)
|
setattr(vm, name, value)
|
||||||
|
Loading…
Reference in New Issue
Block a user