[pve-devel] [PATCH qemu-server v2 8/8] return error from guest-agent
Dominik Csapak
d.csapak at proxmox.com
Thu Feb 15 14:04:53 CET 2018
in case of e.g. a non-existant guest-agent command, it would return
{ error: {someerrorobject} }
but we did only include the 'return' property
in case we do not get any and the error property is set,
return that
i looked at all the paths were we use the QMPClient, and either
we have our own callback for the result,
or we do not rely on the result being empty upon an error, so this
should not break anything
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v2
PVE/QMPClient.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/PVE/QMPClient.pm b/PVE/QMPClient.pm
index 9e32533..e08909b 100755
--- a/PVE/QMPClient.pm
+++ b/PVE/QMPClient.pm
@@ -92,6 +92,8 @@ sub cmd {
my $callback = sub {
my ($vmid, $resp) = @_;
$result = $resp->{'return'};
+ # return error message if we have one and no result
+ $result = { error => $resp->{'error'} } if !$result && $resp->{'error'};
};
die "no command specified" if !($cmd && $cmd->{execute});
--
2.11.0
More information about the pve-devel
mailing list