From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 9CF531FF19B for <inbox@lore.proxmox.com>; Wed, 25 Jun 2025 18:01:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ACB3C19B10; Wed, 25 Jun 2025 17:58:41 +0200 (CEST) From: Fiona Ebner <f.ebner@proxmox.com> To: pve-devel@lists.proxmox.com Date: Wed, 25 Jun 2025 17:56:44 +0200 Message-ID: <20250625155751.268047-22-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250625155751.268047-1-f.ebner@proxmox.com> References: <20250625155751.268047-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server 21/31] drive mirror: add variable for device ID and make name for drive ID precise X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> Suggested-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> --- src/PVE/QemuServer/BlockJob.pm | 12 +++++++----- src/test/MigrationTest/QemuMigrateMock.pm | 12 ++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm index 4638fb1e..8a74636c 100644 --- a/src/PVE/QemuServer/BlockJob.pm +++ b/src/PVE/QemuServer/BlockJob.pm @@ -215,7 +215,7 @@ sub qemu_drive_mirror_monitor { sub qemu_drive_mirror { my ( $vmid, - $drive, + $drive_id, $dst_volid, $vmiddst, $is_zero_initialized, @@ -226,11 +226,13 @@ sub qemu_drive_mirror { $src_bitmap, ) = @_; + my $device_id = "drive-$drive_id"; + $jobs = {} if !$jobs; my $qemu_target; my $format; - $jobs->{"drive-$drive"} = {}; + $jobs->{$device_id} = {}; if ($dst_volid =~ /^nbd:/) { $qemu_target = $dst_volid; @@ -247,7 +249,7 @@ sub qemu_drive_mirror { my $opts = { timeout => 10, - device => "drive-$drive", + device => "$device_id", mode => "existing", sync => "full", target => $qemu_target, @@ -263,9 +265,9 @@ sub qemu_drive_mirror { if (defined($bwlimit)) { $opts->{speed} = $bwlimit * 1024; - print "drive mirror is starting for drive-$drive with bandwidth limit: ${bwlimit} KB/s\n"; + print "drive mirror is starting for $device_id with bandwidth limit: ${bwlimit} KB/s\n"; } else { - print "drive mirror is starting for drive-$drive\n"; + print "drive mirror is starting for $device_id\n"; } # if a job already runs for this device we get an error, catch it for cleanup diff --git a/src/test/MigrationTest/QemuMigrateMock.pm b/src/test/MigrationTest/QemuMigrateMock.pm index b69b2b16..bdc574c1 100644 --- a/src/test/MigrationTest/QemuMigrateMock.pm +++ b/src/test/MigrationTest/QemuMigrateMock.pm @@ -140,7 +140,7 @@ $qemu_server_blockjob_module->mock( qemu_drive_mirror => sub { my ( $vmid, - $drive, + $drive_id, $dst_volid, $vmiddst, $is_zero_initialized, @@ -152,13 +152,13 @@ $qemu_server_blockjob_module->mock( ) = @_; die "drive_mirror with wrong vmid: '$vmid'\n" if $vmid ne $test_vmid; - die "qemu_drive_mirror '$drive' error\n" - if $fail_config->{qemu_drive_mirror} && $fail_config->{qemu_drive_mirror} eq $drive; + die "qemu_drive_mirror '$drive_id' error\n" + if $fail_config->{qemu_drive_mirror} && $fail_config->{qemu_drive_mirror} eq $drive_id; my $nbd_info = decode_json(file_get_contents("${RUN_DIR_PATH}/nbd_info")); - die "target does not expect drive mirror for '$drive'\n" - if !defined($nbd_info->{$drive}); - delete $nbd_info->{$drive}; + die "target does not expect drive mirror for '$drive_id'\n" + if !defined($nbd_info->{$drive_id}); + delete $nbd_info->{$drive_id}; file_set_contents("${RUN_DIR_PATH}/nbd_info", to_json($nbd_info)); }, qemu_drive_mirror_monitor => sub { -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel