From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v3 2/4] block job: rename qemu_drive_mirror_monitor() to monitor()
Date: Fri, 13 Feb 2026 17:52:54 +0100 [thread overview]
Message-ID: <20260213165307.177055-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260213165307.177055-1-f.ebner@proxmox.com>
The function is not only used for mirror jobs, but also stream and
commit jobs. The fact that it is for block jobs is already clear from
the module name.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/QemuMigrate.pm | 2 +-
src/PVE/QemuServer.pm | 12 +++---------
src/PVE/QemuServer/BlockJob.pm | 8 +++-----
src/PVE/QemuServer/Blockdev.pm | 10 ++--------
src/test/MigrationTest/QemuMigrateMock.pm | 8 ++++----
src/test/run_qemu_migrate_tests.pl | 4 ++--
6 files changed, 15 insertions(+), 29 deletions(-)
diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index 5ecfc5ef..f7ec3227 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -1558,7 +1558,7 @@ sub phase2 {
# to avoid it trying to re-establish it. We are in blockjob ready state,
# thus, this command changes to it to blockjob complete (see qapi docs)
eval {
- PVE::QemuServer::BlockJob::qemu_drive_mirror_monitor(
+ PVE::QemuServer::BlockJob::monitor(
$vmid, undef, $self->{storage_migration_jobs}, 'cancel',
);
};
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 5d2dbe03..39723c82 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -7294,9 +7294,7 @@ sub pbs_live_restore {
}
mon_cmd($vmid, 'cont');
- PVE::QemuServer::BlockJob::qemu_drive_mirror_monitor(
- $vmid, undef, $jobs, 'auto', 0, 'stream',
- );
+ PVE::QemuServer::BlockJob::monitor($vmid, undef, $jobs, 'auto', 0, 'stream');
print "restore-drive jobs finished successfully, removing all tracking block devices"
. " to disconnect from Proxmox Backup Server\n";
@@ -7415,9 +7413,7 @@ sub live_import_from_files {
}
mon_cmd($vmid, 'cont');
- PVE::QemuServer::BlockJob::qemu_drive_mirror_monitor(
- $vmid, undef, $jobs, 'auto', 0, 'stream',
- );
+ PVE::QemuServer::BlockJob::monitor($vmid, undef, $jobs, 'auto', 0, 'stream');
print "restore-drive jobs finished successfully, removing all tracking block devices\n";
@@ -7925,9 +7921,7 @@ sub clone_disk {
# if this is the case, we have to complete any block-jobs still there from
# previous drive-mirrors
if (($completion && $completion eq 'complete') && (scalar(keys %$jobs) > 0)) {
- PVE::QemuServer::BlockJob::qemu_drive_mirror_monitor(
- $vmid, $newvmid, $jobs, $completion, $qga,
- );
+ PVE::QemuServer::BlockJob::monitor($vmid, $newvmid, $jobs, $completion, $qga);
}
goto no_data_clone;
}
diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm
index 0b22765b..02e21146 100644
--- a/src/PVE/QemuServer/BlockJob.pm
+++ b/src/PVE/QemuServer/BlockJob.pm
@@ -83,7 +83,7 @@ sub qemu_blockjobs_cancel {
# '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
-sub qemu_drive_mirror_monitor {
+sub monitor {
my ($vmid, $vmiddst, $jobs, $completion, $qga, $op) = @_;
$completion //= 'complete';
@@ -310,7 +310,7 @@ sub qemu_drive_mirror {
die "mirroring error: $err\n";
}
- qemu_drive_mirror_monitor($vmid, $vmiddst, $jobs, $completion, $qga);
+ monitor($vmid, $vmiddst, $jobs, $completion, $qga);
}
# Callers should version guard this (only available with a binary >= QEMU 8.2)
@@ -506,9 +506,7 @@ sub blockdev_mirror {
log_warn("unable to delete blockdev '$target_node_name' - $@");
die "error starting blockdev mirrror - $err";
}
- qemu_drive_mirror_monitor(
- $vmid, $dest->{vmid}, $jobs, $completion, $options->{'guest-agent'}, 'mirror',
- );
+ monitor($vmid, $dest->{vmid}, $jobs, $completion, $options->{'guest-agent'}, 'mirror');
}
sub mirror {
diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
index 8eb01b45..be9f588a 100644
--- a/src/PVE/QemuServer/Blockdev.pm
+++ b/src/PVE/QemuServer/Blockdev.pm
@@ -1086,9 +1086,7 @@ sub blockdev_commit {
my $complete = $src_snap && $src_snap ne 'current' ? 'auto' : 'complete';
eval {
- PVE::QemuServer::BlockJob::qemu_drive_mirror_monitor(
- $vmid, undef, $jobs, $complete, 0, 'commit',
- );
+ PVE::QemuServer::BlockJob::monitor($vmid, undef, $jobs, $complete, 0, 'commit');
};
if ($@) {
die "Failed to complete block commit: $@\n";
@@ -1166,11 +1164,7 @@ sub blockdev_stream {
mon_cmd($vmid, 'block-stream', %$options);
$jobs->{$job_id} = {};
- eval {
- PVE::QemuServer::BlockJob::qemu_drive_mirror_monitor(
- $vmid, undef, $jobs, 'auto', 0, 'stream',
- );
- };
+ eval { PVE::QemuServer::BlockJob::monitor($vmid, undef, $jobs, 'auto', 0, 'stream'); };
if ($@) {
die "Failed to complete block stream: $@\n";
}
diff --git a/src/test/MigrationTest/QemuMigrateMock.pm b/src/test/MigrationTest/QemuMigrateMock.pm
index 421f0bb7..8cd2da12 100644
--- a/src/test/MigrationTest/QemuMigrateMock.pm
+++ b/src/test/MigrationTest/QemuMigrateMock.pm
@@ -175,14 +175,14 @@ $qemu_server_blockjob_module->mock(
common_mirror_mock($source->{vmid}, $drive_id);
},
- qemu_drive_mirror_monitor => sub {
+ monitor => sub {
my ($vmid, $vmiddst, $jobs, $completion, $qga) = @_;
if (
- $fail_config->{qemu_drive_mirror_monitor}
- && $fail_config->{qemu_drive_mirror_monitor} eq $completion
+ $fail_config->{block_job_monitor}
+ && $fail_config->{block_job_monitor} eq $completion
) {
- die "qemu_drive_mirror_monitor '$completion' error\n";
+ die "block_job_monitor '$completion' error\n";
}
return;
},
diff --git a/src/test/run_qemu_migrate_tests.pl b/src/test/run_qemu_migrate_tests.pl
index ed2f38ee..05eed1d9 100755
--- a/src/test/run_qemu_migrate_tests.pl
+++ b/src/test/run_qemu_migrate_tests.pl
@@ -1596,10 +1596,10 @@ my $tests = [
unused0 => 'local-dir:149/vm-149-disk-0.qcow2',
},
expected_calls => {},
- expect_die => "qemu_drive_mirror_monitor 'cancel' error",
+ expect_die => "block_job_monitor 'cancel' error",
# note that 'cancel' is also used to finish and that's what this test is about
fail_config => {
- 'qemu_drive_mirror_monitor' => 'cancel',
+ 'block_job_monitor' => 'cancel',
},
expected => {
source_volids => local_volids_for_vm(149),
--
2.47.3
next prev parent reply other threads:[~2026-02-13 16:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 16:52 [PATCH-SERIES qemu-server v3 0/4] small block job related improvements Fiona Ebner
2026-02-13 16:52 ` [PATCH qemu-server v3 1/4] blockdev: commit: improve comment about completion mode Fiona Ebner
2026-02-13 16:52 ` Fiona Ebner [this message]
2026-02-13 16:52 ` [PATCH qemu-server v3 3/4] blockdev: avoid potentially misleading error messages when block job monitor fails Fiona Ebner
2026-02-13 16:52 ` [PATCH qemu-server v3 4/4] introduce dedicated module for snaphsot as volume chain handling Fiona Ebner
2026-02-16 19:13 ` applied-series: [PATCH-SERIES qemu-server v3 0/4] small block job related improvements Thomas Lamprecht
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=20260213165307.177055-3-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