mirror of
https://git.proxmox.com/git/qemu-server
synced 2026-02-01 19:07:54 +00:00
pass timeout to qmp open_connection
This commit is contained in:
parent
037a974634
commit
6d04217600
@ -114,10 +114,12 @@ my $close_connection = sub {
|
||||
};
|
||||
|
||||
my $open_connection = sub {
|
||||
my ($self, $vmid) = @_;
|
||||
my ($self, $vmid, $timeout) = @_;
|
||||
|
||||
my $sname = PVE::QemuServer::qmp_socket($vmid);
|
||||
|
||||
$timeout = 1 if !$timeout;
|
||||
|
||||
my $fh;
|
||||
my $starttime = [gettimeofday];
|
||||
my $count = 0;
|
||||
@ -129,7 +131,7 @@ my $open_connection = sub {
|
||||
die "unable to connect to VM $vmid socket - $!\n";
|
||||
}
|
||||
my $elapsed = tv_interval($starttime, [gettimeofday]);
|
||||
if ($elapsed > 1) {
|
||||
if ($elapsed >= $timeout) {
|
||||
die "unable to connect to VM $vmid socket - timeout after $count retries\n";
|
||||
}
|
||||
usleep(100000);
|
||||
@ -204,7 +206,7 @@ sub queue_execute {
|
||||
next if !scalar(@{$self->{queue}->{$vmid}}); # no commands for the VM
|
||||
|
||||
eval {
|
||||
my $fh = &$open_connection($self, $vmid);
|
||||
my $fh = &$open_connection($self, $vmid, $timeout);
|
||||
my $cmd = { execute => 'qmp_capabilities', arguments => {} };
|
||||
unshift @{$self->{queue}->{$vmid}}, $cmd;
|
||||
$self->{mux}->set_timeout($fh, $timeout);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user