From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D848F1FF2CA for ; Tue, 23 Jul 2024 14:08:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EB4EE2960; Tue, 23 Jul 2024 14:08:36 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Tue, 23 Jul 2024 14:07:59 +0200 Message-Id: <20240723120759.73454-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.061 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm, proxmox.com] Subject: [pve-devel] [PATCH qemu-server] drive mirror: prevent wrongly logging success when completion fails differently X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Currently, when completing a drive mirror job, only errors matching "cannot be completed" will be handled. Other errors are ignored and a wrong message that the job was completed successfully will be printed to the log. An instance of this popped up in the community forum [0]. The QMP command used for completing the job is either 'block-job-complete' or 'block-job-cancel'. The former causes the VM to switch to the target drive, the latter doesn't, e.g. migration uses the latter to not switch the source instance over to the target drive. The 'block-job-cancel' command doesn't even have the same "cannot be completed" message, but returns immediately. The timeout for both 'block-job-cancel' and 'block-job-complete' is set to 10 minutes in the QMPClient module, which should be enough. [0]: https://forum.proxmox.com/threads/151518/ Signed-off-by: Fiona Ebner --- PVE/QemuServer.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index bf59b091..beabb6df 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -8112,10 +8112,13 @@ sub qemu_drive_mirror_monitor { die "invalid completion value: $completion\n"; } eval { mon_cmd($vmid, $op, device => $job_id) }; - if ($@ =~ m/cannot be completed/) { + my $err = $@; + if ($err && $err =~ m/cannot be completed/) { print "$job_id: block job cannot be completed, trying again.\n"; $err_complete++; - }else { + } elsif ($err) { + die "$job_id: block job cannot be completed - $err\n"; + } else { print "$job_id: Completed successfully.\n"; $jobs->{$job_id}->{complete} = 1; } -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel