mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-30 00:30:42 +00:00
fix command timeout
This commit is contained in:
parent
03a33f3005
commit
f0002f62f1
@ -50,7 +50,7 @@ sub queue_cmd {
|
|||||||
|
|
||||||
# execute a single command
|
# execute a single command
|
||||||
sub cmd {
|
sub cmd {
|
||||||
my ($self, $vmid, $cmd) = @_;
|
my ($self, $vmid, $cmd, $timeout) = @_;
|
||||||
|
|
||||||
my $result;
|
my $result;
|
||||||
|
|
||||||
@ -59,12 +59,23 @@ sub cmd {
|
|||||||
$result = $resp->{'return'};
|
$result = $resp->{'return'};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
die "no command specified" if !($cmd && $cmd->{execute});
|
||||||
|
|
||||||
$cmd->{callback} = $callback;
|
$cmd->{callback} = $callback;
|
||||||
$cmd->{arguments} = {} if !defined($cmd->{arguments});
|
$cmd->{arguments} = {} if !defined($cmd->{arguments});
|
||||||
|
|
||||||
$self->{queue}->{$vmid} = [ $cmd ];
|
$self->{queue}->{$vmid} = [ $cmd ];
|
||||||
|
|
||||||
$self->queue_execute();
|
if (!$timeout) {
|
||||||
|
# hack: monitor sometime blocks
|
||||||
|
if ($cmd->{execute} eq 'query-migrate') {
|
||||||
|
$timeout = 60*60; # 1 hour
|
||||||
|
} elsif ($cmd->{execute} =~ m/^(eject|change)/) {
|
||||||
|
$timeout = 60; # note: cdrom mount command is slow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->queue_execute($timeout);
|
||||||
|
|
||||||
my $cmdstr = $cmd->{execute} || '';
|
my $cmdstr = $cmd->{execute} || '';
|
||||||
die "VM $vmid qmp command '$cmdstr' failed - $self->{errors}->{$vmid}"
|
die "VM $vmid qmp command '$cmdstr' failed - $self->{errors}->{$vmid}"
|
||||||
|
Loading…
Reference in New Issue
Block a user