mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-29 07:10:36 +00:00
qmpclient: use guest-sync-delimited
This commit is contained in:
parent
c2b9bbf33a
commit
5cb6fe54d8
@ -107,6 +107,9 @@ sub cmd {
|
|||||||
$timeout = 60*60; # 1 hour
|
$timeout = 60*60; # 1 hour
|
||||||
} elsif ($cmd->{execute} =~ m/^(eject|change)/) {
|
} elsif ($cmd->{execute} =~ m/^(eject|change)/) {
|
||||||
$timeout = 60; # note: cdrom mount command is slow
|
$timeout = 60; # note: cdrom mount command is slow
|
||||||
|
} elsif ($cmd->{execute} eq 'guest-fsfreeze-freeze' ||
|
||||||
|
$cmd->{execute} eq 'guest-fsfreeze-thaw') {
|
||||||
|
$timeout = 10;
|
||||||
} elsif ($cmd->{execute} eq 'savevm-start' ||
|
} elsif ($cmd->{execute} eq 'savevm-start' ||
|
||||||
$cmd->{execute} eq 'savevm-end' ||
|
$cmd->{execute} eq 'savevm-end' ||
|
||||||
$cmd->{execute} eq 'query-backup' ||
|
$cmd->{execute} eq 'query-backup' ||
|
||||||
@ -249,7 +252,8 @@ my $check_queue = sub {
|
|||||||
|
|
||||||
if ($qga) {
|
if ($qga) {
|
||||||
|
|
||||||
$qmpcmd = to_json({ execute => 'guest-sync', arguments => { id => int($cmd->{id})}}) .
|
$qmpcmd = to_json({ execute => 'guest-sync-delimited',
|
||||||
|
arguments => { id => int($cmd->{id})}}) .
|
||||||
to_json({ execute => $cmd->{execute}, arguments => $cmd->{arguments}});
|
to_json({ execute => $cmd->{execute}, arguments => $cmd->{arguments}});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -364,7 +368,7 @@ sub mux_input {
|
|||||||
my $raw;
|
my $raw;
|
||||||
|
|
||||||
if ($qga) {
|
if ($qga) {
|
||||||
return if $$input !~ s/^([^\n]+}\r?\n[^\n]+})\r?\n(.*)$/$2/so;
|
return if $$input !~ s/^.*\xff([^\n]+}\r?\n[^\n]+})\r?\n(.*)$/$2/so;
|
||||||
$raw = $1;
|
$raw = $1;
|
||||||
} else {
|
} else {
|
||||||
return if $$input !~ s/^(.*})\r?\n(.*)$/$2/so;
|
return if $$input !~ s/^(.*})\r?\n(.*)$/$2/so;
|
||||||
@ -382,6 +386,9 @@ sub mux_input {
|
|||||||
|
|
||||||
my $cmdid = $obj->{'return'};
|
my $cmdid = $obj->{'return'};
|
||||||
die "received responsed without command id\n" if !$cmdid;
|
die "received responsed without command id\n" if !$cmdid;
|
||||||
|
|
||||||
|
# skip results fro previous commands
|
||||||
|
return if $cmdid < $curcmd->{id};
|
||||||
|
|
||||||
if ($curcmd->{id} ne $cmdid) {
|
if ($curcmd->{id} ne $cmdid) {
|
||||||
die "got wrong command id '$cmdid' (expected $curcmd->{id})\n";
|
die "got wrong command id '$cmdid' (expected $curcmd->{id})\n";
|
||||||
@ -464,7 +471,7 @@ sub mux_eof {
|
|||||||
|
|
||||||
if ($qga && $qga_allow_close_cmds->{$curcmd->{execute}}) {
|
if ($qga && $qga_allow_close_cmds->{$curcmd->{execute}}) {
|
||||||
|
|
||||||
return if $$input !~ s/^([^\n]+})\r?\n(.*)$/$2/so;
|
return if $$input !~ s/^.*\xff([^\n]+})\r?\n(.*)$/$2/so;
|
||||||
|
|
||||||
my $raw = $1;
|
my $raw = $1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user