[pve-devel] [PATCH 1/2] block-job-cancel : wait that jobs is really finished

Alexandre DERUMIER aderumier at odiso.com
Fri Nov 7 11:19:36 CET 2014


>>what if we get an error here? The following while loop will wait forever? 

I think we could remove the eval.

Like this, if cancel fail (I'm not sure It can happen because it's async, but maybe qmp command timeout),
we will exit from the task.








----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Vendredi 7 Novembre 2014 11:03:04 
Objet: RE: [pve-devel] [PATCH 1/2] block-job-cancel : wait that jobs is really finished 

> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 98264d1..a79606c 
> 100644 
> --- a/PVE/QemuServer.pm 
> +++ b/PVE/QemuServer.pm 
> @@ -5215,12 +5215,24 @@ sub qemu_drive_mirror { 
> }; 
> if (my $err = $@) { 
> eval { vm_mon_cmd($vmid, "block-job-cancel", device => "drive- 
> $drive"); }; 

what if we get an error here? The following while loop will wait forever? 

> + while (1) { 
> + my $stats = vm_mon_cmd($vmid, "query-block-jobs"); 
> + my $stat = @$stats[0]; 
> + last if !$stat; 
> + sleep 1; 
> + } 
> die "mirroring error: $err"; 
> } 
> 
> if ($vmiddst != $vmid) { 
> # if we clone a disk for a new target vm, we don't switch the disk 
> vm_mon_cmd($vmid, "block-job-cancel", device => "drive-$drive"); 
> + while (1) { 
> + my $stats = vm_mon_cmd($vmid, "query-block-jobs"); 
> + my $stat = @$stats[0]; 
> + last if !$stat; 
> + sleep 1; 
> + } 
> } 
> } 
> } 
> -- 
> 1.7.10.4 
> 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 



More information about the pve-devel mailing list