+ my $queue_info = &$push_cmd_to_queue($self, $vmid, $cmd);
+
+ 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
+ } elsif ($cmd->{execute} eq 'guest-fsfreeze-freeze') {
+ # freeze syncs all guest FS, if we kill it it stays in an unfreezable
+ # locked state with high probability, so use an generous timeout
+ $timeout = 60*60; # 1 hour
+ } elsif ($cmd->{execute} eq 'guest-fsfreeze-thaw') {
+ # While it should return instantly or never (dead locked) for Linux guests,
+ # the variance for Windows guests can be big. And there might be hook scripts
+ # that are executed upon thaw, so use 3 minutes to be on the safe side.
+ $timeout = 3 * 60;
+ } elsif (
+ $cmd->{execute} eq 'savevm-start' ||
+ $cmd->{execute} eq 'savevm-end' ||
+ $cmd->{execute} eq 'query-backup' ||
+ $cmd->{execute} eq 'query-block-jobs' ||
+ $cmd->{execute} eq 'block-job-cancel' ||
+ $cmd->{execute} eq 'block-job-complete' ||
+ $cmd->{execute} eq 'backup-cancel' ||
+ $cmd->{execute} eq 'query-savevm' ||
+ $cmd->{execute} eq 'guest-fstrim' ||
+ $cmd->{execute} eq 'guest-shutdown' ||
+ $cmd->{execute} eq 'blockdev-snapshot-internal-sync' ||
+ $cmd->{execute} eq 'blockdev-snapshot-delete-internal-sync'
+ ) {
+ $timeout = 10*60; # 10 mins ?
+ } else {
+ # NOTE: if you came here as user and want to change this, try using IO-Threads first
+ # which move out quite some processing of the main thread, leaving more time for QMP
+ $timeout = 5; # default
+ }
+ }