public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server] qmp: avoid using deprecated block-job-* commands
Date: Thu, 29 Jan 2026 17:17:58 +0100	[thread overview]
Message-ID: <20260129161923.220661-1-f.ebner@proxmox.com> (raw)

All of the following QMP commands were deprecated [0]:
block-job-pause
block-job-resume
block-job-complete
block-job-dismiss
block-job-finalize

Of these, only 'block-job-complete' was used in qemu-server. Replace
it with the 'job-complete' command. The only differences are:
1. using 'id' instead of 'device' as the argument name
2. using a different error type if no job with that ID is found
The error type is not checked anywhere, so it is equivalent.

Note that block-job-cancel has not been deprecated, because of the
special semantics for a mirror job in ready state (job will complete,
but QEMU instance will not switch to using mirror target).

[0]: https://qemu-project.gitlab.io/qemu/about/deprecated.html

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QMPClient.pm           |  2 +-
 src/PVE/QemuServer/BlockJob.pm | 28 ++++++++++++++--------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/PVE/QMPClient.pm b/src/PVE/QMPClient.pm
index c3ed0e32..723123a6 100644
--- a/src/PVE/QMPClient.pm
+++ b/src/PVE/QMPClient.pm
@@ -133,7 +133,7 @@ sub cmd {
             || $cmd->{execute} eq 'blockdev-del'
             || $cmd->{execute} eq 'blockdev-mirror'
             || $cmd->{execute} eq 'block-job-cancel'
-            || $cmd->{execute} eq 'block-job-complete'
+            || $cmd->{execute} eq 'job-complete'
             || $cmd->{execute} eq 'drive-mirror'
             || $cmd->{execute} eq 'guest-fstrim'
             || $cmd->{execute} eq 'guest-shutdown'
diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm
index 12e74aac..0b22765b 100644
--- a/src/PVE/QemuServer/BlockJob.pm
+++ b/src/PVE/QemuServer/BlockJob.pm
@@ -79,7 +79,7 @@ sub qemu_blockjobs_cancel {
 }
 
 # $completion can be either
-# 'complete': wait until all jobs are ready, block-job-complete them (default)
+# 'complete': wait until all jobs are ready, job-complete them (default)
 # 'cancel': wait until all jobs are ready, block-job-cancel them
 # 'skip': wait until all jobs are ready, return with block jobs in ready state
 # 'auto': wait until all jobs disappear, only use for jobs which complete automatically
@@ -193,22 +193,22 @@ sub qemu_drive_mirror_monitor {
                         # try to switch the disk if source and destination are on the same guest
                         print "$job_id: Completing block job...\n";
 
-                        my $completion_command;
                         # For blockdev, need to detach appropriate node. QEMU will only drop it if
                         # it was implicitly added (e.g. as the child of a top throttle node), but
                         # not if it was explicitly added via blockdev-add (e.g. as a previous mirror
                         # target).
                         my $detach_node_name;
-                        if ($completion eq 'complete') {
-                            $completion_command = 'block-job-complete';
-                            $detach_node_name = $jobs->{$job_id}->{'source-node-name'};
-                        } elsif ($completion eq 'cancel') {
-                            $completion_command = 'block-job-cancel';
-                            $detach_node_name = $jobs->{$job_id}->{'target-node-name'};
-                        } else {
-                            die "invalid completion value: $completion\n";
-                        }
-                        eval { mon_cmd($vmid, $completion_command, device => $job_id) };
+                        eval {
+                            if ($completion eq 'complete') {
+                                $detach_node_name = $jobs->{$job_id}->{'source-node-name'};
+                                mon_cmd($vmid, 'job-complete', id => $job_id);
+                            } elsif ($completion eq 'cancel') {
+                                $detach_node_name = $jobs->{$job_id}->{'target-node-name'};
+                                mon_cmd($vmid, 'block-job-cancel', device => $job_id);
+                            } else {
+                                die "invalid completion value: $completion\n";
+                            }
+                        };
                         my $err = $@;
                         if ($err && $err =~ m/cannot be completed/) {
                             print "$job_id: block job cannot be completed, trying again.\n";
@@ -407,8 +407,8 @@ All jobs must be ready before completion can happen.
 
 =over
 
-=item C<complete>: Wait until all jobs are ready, block-job-complete them (default). This means
-switching the original drive to use the new target.
+=item C<complete>: Wait until all jobs are ready, job-complete them (default). This means switching
+the original drive to use the new target.
 
 =item C<cancel>: Wait until all jobs are ready, block-job-cancel them. This means not switching the
 original drive to use the new target.
-- 
2.47.3





                 reply	other threads:[~2026-01-29 16:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260129161923.220661-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal