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

Dietmar Maurer dietmar at proxmox.com
Fri Nov 7 11:03:04 CET 2014


> 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