or maybe, put the block-job-cancel in the loop

 while (1) { 
 eval { vm_mon_cmd($vmid, "block-job-cancel", device => "drive-$drive"); }; 
 my $stats = vm_mon_cmd($vmid, "query-block-jobs"); 
 my $stat = @$stats[0]; 
 last if !$stat; 
 sleep 1; 
}

Like this we retry also the cancel
 
----- Mail original ----- 

De: "Alexandre DERUMIER" <[email protected]> 
À: "Dietmar Maurer" <[email protected]> 
Cc: [email protected] 
Envoyé: Vendredi 7 Novembre 2014 11:19:36 
Objet: Re: [pve-devel] [PATCH 1/2] block-job-cancel : wait that jobs is really 
finished 

>>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" <[email protected]> 
À: "Alexandre Derumier" <[email protected]>, [email protected] 
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 
> [email protected] 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 
_______________________________________________ 
pve-devel mailing list 
[email protected] 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 
_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to