Fix switching console type from telnet to VNC throws error.

This commit is contained in:
grossmj 2018-06-09 22:08:30 +07:00
parent 6caf38206c
commit 34fcbd68f3

View File

@ -118,7 +118,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)