[pve-devel] [PATVH_V2] Bug Fix 602

Dietmar Maurer dietmar at proxmox.com
Thu Mar 5 14:13:17 CET 2015


On 03/03/2015 01:17 PM, Wolfgang Link wrote:
> now zfs will wait 5 sec if error msg is "dataset is busy"
>
> Signed-off-by: Wolfgang Link <w.link at proxmox.com>
> ---
>   PVE/Storage/ZFSPoolPlugin.pm |   28 ++++++++++++++++++++++++++--
>   1 file changed, 26 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
> index 5cbd1b2..0f666b0 100644
> --- a/PVE/Storage/ZFSPoolPlugin.pm
> +++ b/PVE/Storage/ZFSPoolPlugin.pm
> @@ -166,7 +166,16 @@ sub zfs_request {
>           $msg .= "$line\n";
>       };
>   
> -    run_command($cmd, outfunc => $output, timeout => $timeout);
> +    if ($method eq "destroy") {
> +
> +	eval {run_command($cmd, errmsg => 1, outfunc => $output, timeout => $timeout);};
> +	
> +	if(my $err = $@) {
> +	    return "ERROR $err";
> +	}

You can do exactly the same thing with:

   if ($method eq "destroy") {

	run_command($cmd, errmsg => "ERROR ", outfunc => $output, timeout => $timeout);

     }

I.e. there is no need for that additional 'eval'. Please test.


> +    } else {
> +	run_command($cmd, outfunc => $output, timeout => $timeout);
> +    }
>   

I am also not sure why we cant use above code for all function? We just 
need to replace 'ERROR ' with something more descriptive:

   run_command($cmd, errmsg => "zfs error: ", outfunc => $output, 
timeout => $timeout);

This assume that the zfs commands always return a useful error messages 
as last line on stderr. But I guess
this is a valid assumption?






More information about the pve-devel mailing list