[pve-devel] [PATCH 07/09] Explicite use user root when making ssh call.

Dietmar Maurer dietmar at proxmox.com
Tue Aug 13 06:12:52 CEST 2013


Why is that required?

> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of mir at datanom.net
> Sent: Montag, 12. August 2013 20:09
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] [PATCH 07/09] Explicite use user root when making ssh call.
> 
> From: Michael Rasmussen <mir at datanom.net>
> 
> Signed-off-by: Michael Rasmussen <mir at datanom.net>
> ---
>  PVE/Storage/ZFSPlugin.pm | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm index
> 0ec6632..a562635 100644
> --- a/PVE/Storage/ZFSPlugin.pm
> +++ b/PVE/Storage/ZFSPlugin.pm
> @@ -19,6 +19,7 @@ sub zfs_request {
>  	my $cmd;
>  	my $msg = '';
>  	my $zfs;
> +	my $target;
> 
>  	my $output = sub {
>  		my $line = shift;
> @@ -39,9 +40,14 @@ sub zfs_request {
>  		die 'unknown iscsi provider. Available [comstar]';
>  	}
> 
> -	$luncmd->{cmd} = 'sudo ' . $luncmd->{cmd} if ($scfg->{sudo});
> +	if ($scfg->{sudo}) {
> +			$luncmd->{cmd} = 'sudo ' . $luncmd->{cmd};
> +			$target = $scfg->{portal};
> +	} else {
> +			$target = 'root@' . $scfg->{portal};
> +	}
>  	if ($luncmd->{$method}) {
> -		$cmd = [@ssh_cmd, $scfg->{portal}, $luncmd->{cmd}, $luncmd-
> >{$method}, @params];
> +		$cmd = [@ssh_cmd, $target, $luncmd->{cmd}, $luncmd-
> >{$method},
> + at params];
>  	} else {
>  		if ($method =~ /^zpool-list$/) {
>  			$zfs = 'zpool';
> @@ -49,7 +55,7 @@ sub zfs_request {
>  		} else {
>  			$zfs = 'zfs';
>  		}
> -		$cmd = [@ssh_cmd, $scfg->{portal}, $zfs, $method, @params];
> +		$cmd = [@ssh_cmd, $target, $zfs, $method, @params];
>  	}
> 
>  	eval {
> --
> 1.8.4.rc2
> 
> _______________________________________________
> 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