QMP: always return the command result
authorApollon Oikonomopoulos <apoikos@gmail.com>
Mon, 7 Apr 2014 13:37:43 +0000 (16:37 +0300)
committerThomas Thrainer <thomasth@google.com>
Tue, 8 Apr 2014 09:15:17 +0000 (11:15 +0200)
commit24d3d8da5f914409eebf0c7df99001c9523cf42c
tree60f847fdf230af55ecff96e2873b3ff9b00ab1f4
parentc309d05fe5d7c338e98048f0b9bc0775eb0e3e19
QMP: always return the command result

According to the QEMU Machine Protocol Specification, the messages sent
by QMP as a response to a command can be of two types: either an error
message (identified by the "error" key), or a success message
(identified by the "return" key).

Since we explicitly handle errors by raising a HypervisorError, there is
no reason to return the whole response message; instead we return only
the response part, which is the dual behavior of accepting commands from
the callers without the surrounding {"execute": ...} object.

We also unexport the RETURN_KEY constant, which is now only used
internally.

Signed-off-by: Apollon Oikonomopoulos <apoikos@gmail.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
lib/hypervisor/hv_kvm/__init__.py
lib/hypervisor/hv_kvm/monitor.py
test/py/ganeti.hypervisor.hv_kvm_unittest.py