[pve-devel] [PATCH qemu-server] Improve error output for queues

Aaron Lauterer a.lauterer at proxmox.com
Mon Aug 26 13:47:21 CEST 2019

Add the name of the failed command to the error message, similar as the
error messages when running a single command.

Reason: I had a situation with a customer where we got an error but
could not connect it to which command actually caused it. A similar but
way hackier patch proved helpful to get more information. It was
`qmp_capabilities` which caused a timeout.

AFAIU single commands already log the actual command in the error (see
line 140).

Open questions:
* How to force an error that will cause this code to be executed? Right
now I have no idea how to test this.
* Should the format of the error message be exactly the same as for a
single command? Maybe a slightly different wording will help to
distinguish between the two?

 PVE/QMPClient.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/QMPClient.pm b/PVE/QMPClient.pm
index 6be4a41..56d7629 100755
--- a/PVE/QMPClient.pm
+++ b/PVE/QMPClient.pm
@@ -250,6 +250,7 @@ my $check_queue = sub {
 	eval {
 	    my $cmd = $queue_info->{current} = shift @{$queue_info->{cmds}};
+	    $queue_info->{last_cmd} = $cmd;
 	    $cmd->{id} = &$next_cmdid($qga);
 	    my $fd = -1;
@@ -341,7 +342,7 @@ sub queue_execute {
 	    if ($noerr) {
 		warn $queue_info->{error} if $noerr < 2;
 	    } else {
-		$errors .= $queue_info->{error}
+		$errors .= "VM $queue_info->{vmid} qmp command '$queue_info->{last_cmd}['execute']' failed - $queue_info->{error}";

More information about the pve-devel mailing list