]> git.proxmox.com Git - qemu-server.git/commitdiff
Fix guest agent shutdown without timeout
authorStefan Reiter <s.reiter@proxmox.com>
Mon, 18 Nov 2019 14:41:11 +0000 (15:41 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 18 Nov 2019 18:52:30 +0000 (19:52 +0100)
Regression from change allowing timeouts to be set, now shutting down
also works without timeouts again (previously qmp failed because of
the unknown "timeout" parameter passed to it).

We always delete the timeout value from the arguments, regardless of
truthiness. "delete" returns the deleted element, deleting a
non-existant hash entry returns undef, which is fine after this point:

"deleting non-existent elements returns the undefined value in their
corresponding positions."
- https://perldoc.perl.org/functions/delete.html

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
(cherry picked from commit 1688362d4e0367888c9d2f592e7948e5b4e8069a)
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
PVE/QemuServer.pm

index f6ee4b8113350e64b725fdf19db6d9b05f0eec64..1228a0b3a0f69419619b812e67d0bfc4914def08 100644 (file)
@@ -5460,9 +5460,8 @@ sub vm_qmp_command {
     my $res;
 
     my $timeout;
-    if ($cmd->{arguments} && $cmd->{arguments}->{timeout}) {
-       $timeout = $cmd->{arguments}->{timeout};
-       delete $cmd->{arguments}->{timeout};
+    if ($cmd->{arguments}) {
+       $timeout = delete $cmd->{arguments}->{timeout};
     }
 
     eval {