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

Alexandre DERUMIER aderumier at odiso.com
Fri Nov 7 12:18:50 CET 2014


>> I think we should just skip the loop if we get an error. 

Is this code ok for you ?:


if (my $err = $@) {

 eval { vm_mon_cmd($vmid, "block-job-cancel", device => "drive-$drive"); };

 if(!$@){
   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 $err;
}
----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre DERUMIER" <aderumier at odiso.com> 
Cc: pve-devel at pve.proxmox.com 
Envoyé: Vendredi 7 Novembre 2014 11:45:38 
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. 

no, that way we lose the original error message. 

I think we should just skip the loop if we get an error. 



More information about the pve-devel mailing list