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

Dietmar Maurer dietmar at proxmox.com
Fri Nov 7 15:45:36 CET 2014


I finally implement it this way:

https://git.proxmox.com/?p=qemu-server.git;a=commitdiff;h=bcc87408c06c860d190981c5e77067e3d0c3298f


> >> 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;
> }


More information about the pve-devel mailing list