[pve-devel] [PATCH 5/6] ISCSIDirect : fixes and cleanup

Alexandre DERUMIER aderumier at odiso.com
Sun Aug 5 09:46:53 CEST 2012


Ok,thanks, I'll correct that.

from https://github.com/sahlberg/libiscsi/blob/master/src/iscsi-ls.c,
possible value are: {' ', 'k', 'M', 'G', 'T' };

They are no option to choose unit value, so I'll need parse each of them.


----- Mail original ----- 

De: "Stefan Priebe" <s.priebe at profihost.ag> 
À: "Alexandre Derumier" <aderumier at odiso.com> 
Cc: pve-devel at pve.proxmox.com 
Envoyé: Dimanche 5 Août 2012 09:29:56 
Objet: Re: [pve-devel] [PATCH 5/6] ISCSIDirect : fixes and cleanup 

To me I had a line with size x.xT for terrabyte. So just matching for G isn't enough. 

Stefan 

Am 05.08.2012 um 09:24 schrieb Alexandre Derumier <aderumier at odiso.com>: 

> -use "lunX" for volume name. 
> previously it was only the lun number, and it conflict with current syntax to disk alloc disk size. 
> 
> -scsi-ls return size in Gb, so we need to convert to bytes 
> 
> -small cleanups 
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com> 
> --- 
> PVE/Storage/ISCSIDirectPlugin.pm | 21 +++++++-------------- 
> 1 files changed, 7 insertions(+), 14 deletions(-) 
> 
> diff --git a/PVE/Storage/ISCSIDirectPlugin.pm b/PVE/Storage/ISCSIDirectPlugin.pm 
> index 6279aae..6233fa1 100644 
> --- a/PVE/Storage/ISCSIDirectPlugin.pm 
> +++ b/PVE/Storage/ISCSIDirectPlugin.pm 
> @@ -17,29 +17,20 @@ sub iscsi_ls { 
> my $portal = $scfg->{portal}; 
> my $cmd = ['/usr/bin/iscsi-ls', '-s', 'iscsi://'.$portal ]; 
> my $list = {}; 
> - my $test = ""; 
> - 
> - my $errfunc = sub { 
> - my $line = shift; 
> - $line = trim($line); 
> - 
> - die $line if $line; 
> - }; 
> 
> eval { 
> 
> - run_command($cmd, errmsg => "iscsi error", errfunc => $errfunc, outfunc => sub { 
> + run_command($cmd, errmsg => "iscsi error", errfunc => sub {}, outfunc => sub { 
> my $line = shift; 
> + print $line."\n"; 
> $line = trim($line); 
> if( $line =~ /Lun:(\d+)\s+([A-Za-z0-9\-\_\.\:]*)\s+\(Size:(\d+)G\)/ ) { 
> - $test = $1; 
> - 
> - my $image = $1; 
> + my $image = "lun".$1; 
> my $size = $3; 
> 
> $list->{$storeid}->{$image} = { 
> name => $image, 
> - size => $size, 
> + size => $size*1024*1024*1024, 
> }; 
> } 
> }); 
> @@ -47,7 +38,9 @@ sub iscsi_ls { 
> 
> my $err = $@; 
> die $err if $err && $err !~ m/TESTUNITREADY failed with SENSE KEY/ ; 
> + 
> return $list; 
> + 
> } 
> 
> # Configuration 
> @@ -78,7 +71,7 @@ sub parse_volname { 
> my ($class, $volname) = @_; 
> 
> 
> - if ($volname =~ m/^(\d+)$/) { 
> + if ($volname =~ m/^lun(\d+)$/) { 
> return ('images', $1, undef); 
> } 
> 
> -- 
> 1.7.2.5 
> 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 



-- 

-- 



	

Alexandre D e rumier 

Ingénieur Systèmes et Réseaux 


Fixe : 03 20 68 88 85 

Fax : 03 20 68 90 88 


45 Bvd du Général Leclerc 59100 Roubaix 
12 rue Marivaux 75002 Paris 



More information about the pve-devel mailing list