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

Reply via email to