public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] drive mirror: prevent wrongly logging success when completion fails differently
@ 2024-07-23 12:07 Fiona Ebner
  2024-07-30 19:18 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2024-07-23 12:07 UTC (permalink / raw)
  To: 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 <f.ebner@proxmox.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] drive mirror: prevent wrongly logging success when completion fails differently
  2024-07-23 12:07 [pve-devel] [PATCH qemu-server] drive mirror: prevent wrongly logging success when completion fails differently Fiona Ebner
@ 2024-07-30 19:18 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-07-30 19:18 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 23/07/2024 um 14:07 schrieb Fiona Ebner:
> 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 <f.ebner@proxmox.com>
> ---
>  PVE/QemuServer.pm | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

applied, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-30 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-23 12:07 [pve-devel] [PATCH qemu-server] drive mirror: prevent wrongly logging success when completion fails differently Fiona Ebner
2024-07-30 19:18 ` [pve-devel] applied: " Thomas Lamprecht

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