]> git.proxmox.com Git - qemu-server.git/commitdiff
set default qmp timout to 3 seconds
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 27 Aug 2012 11:13:36 +0000 (13:13 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 27 Aug 2012 11:13:36 +0000 (13:13 +0200)
And allow to pass timeout paramater to vm_qmp_command().

PVE/QMPClient.pm
PVE/QemuServer.pm

index 85d307eaf9db613801726be59fc43827f66035b3..cc975abe693ee868b5abac74940c606a60417ff0 100755 (executable)
@@ -72,6 +72,8 @@ sub cmd {
            $timeout = 60*60; # 1 hour
        } elsif ($cmd->{execute} =~ m/^(eject|change)/) {
            $timeout = 60; # note: cdrom mount command is slow
+       } else {
+           $timeout = 3; # default
        }
     }
 
index c7e9a07e9648a53c1b8623e6a2bd37812a5e2469..79231ebe6bdb3456012e82808314f9cadfb06b5b 100644 (file)
@@ -2808,13 +2808,19 @@ sub vm_qmp_command {
 
     my $res;
 
+    my $timeout;
+    if ($cmd->{arguments} && $cmd->{arguments}->{timeout}) {
+       $timeout = $cmd->{arguments}->{timeout};
+       delete $cmd->{arguments}->{timeout};
+    }
     eval {
        die "VM $vmid not running\n" if !check_running($vmid, $nocheck);
        my $sname = PVE::QemuServer::qmp_socket($vmid);
        if (-e $sname) {
            my $qmpclient = PVE::QMPClient->new();
 
-           $res = $qmpclient->cmd($vmid, $cmd);
+           $res = $qmpclient->cmd($vmid, $cmd, $timeout);
        } elsif (-e "${var_run_tmpdir}/$vmid.mon") {
            die "can't execute complex command on old monitor - stop/start your vm to fix the problem\n"
                if scalar(%{$cmd->{arguments}});