mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-13 16:28:37 +00:00
set default qmp timout to 3 seconds
And allow to pass timeout paramater to vm_qmp_command().
This commit is contained in:
parent
eb26097ef4
commit
14db53662a
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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}});
|
||||
|
Loading…
Reference in New Issue
Block a user