Fix switching console type from telnet to VNC throws error. Fixes #2489.

This commit is contained in:
grossmj 2018-06-09 21:47:36 +07:00
parent 1905a99ce7
commit 40151cd1fe
5 changed files with 9 additions and 4 deletions

View File

@ -442,7 +442,7 @@ class BaseNode:
return
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:
self._manager.port_manager.release_tcp_port(self._console, self._project)

View File

@ -387,7 +387,7 @@ class Node:
if prop not in self.CONTROLLER_ONLY_PROPERTIES:
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":
compute_properties = kwargs[prop]
else:

View File

@ -120,7 +120,8 @@ class QEMUHandler:
qemu_manager = Qemu.instance()
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():
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)

View File

@ -138,6 +138,9 @@ class VirtualBoxHandler:
if ram != vm.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():
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)

View File

@ -106,7 +106,8 @@ class VMwareHandler:
vmware_manager = VMware.instance()
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():
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)