Obtain the FreeNAS username and password values from storage.cfg
- Added the ability to process two new fields in the storage.cfg under an iSCSI configuration. freenas_user <username> freenas_password <password> No more editing the FreeNAS.pm file
This commit is contained in:
		
							parent
							
								
									af42dfd008
								
							
						
					
					
						commit
						ad8ca3aca8
					
				|  | @ -1,37 +1,61 @@ | |||
| --- mountpoint/PVE/Storage/ZFSPlugin.pm	2017-05-17 15:19:32.000000000 +0200
 | ||||
| +++ mountpoint/PVE/Storage/ZFSPlugin.pm	2017-05-17 15:24:07.000000000 +0200
 | ||||
| @@ -12,6 +12,7 @@
 | ||||
| --- ZFSPlugin.pm.orig   2018-04-17 09:52:36.917394028 -0400
 | ||||
| +++ ZFSPlugin.pm        2018-04-18 14:20:52.711457607 -0400
 | ||||
| @@ -10,6 +10,7 @@
 | ||||
| 
 | ||||
|  use base qw(PVE::Storage::ZFSPoolPlugin); | ||||
|  use PVE::Storage::LunCmd::Comstar; | ||||
| +use PVE::Storage::LunCmd::FreeNAS;
 | ||||
|  use PVE::Storage::LunCmd::Istgt; | ||||
|  use PVE::Storage::LunCmd::Iet; | ||||
| +use PVE::Storage::LunCmd::FreeNAS;
 | ||||
| 
 | ||||
|   | ||||
|  my @ssh_opts = ('-o', 'BatchMode=yes'); | ||||
| @@ -31,7 +32,7 @@
 | ||||
|  my $zfs_unknown_scsi_provider = sub { | ||||
|      my ($provider) = @_; | ||||
| 
 | ||||
| -    die "$provider: unknown iscsi provider. Available [comstar, istgt, iet]";
 | ||||
| +    die "$provider: unknown iscsi provider. Available [comstar, istgt, iet, freenas]";
 | ||||
| +    die "$provider: unknown iscsi provider. Available [comstar, freenas, istgt, iet]";
 | ||||
|  }; | ||||
| 
 | ||||
|  my $zfs_get_base = sub { | ||||
| @@ -43,6 +44,8 @@
 | ||||
|          return PVE::Storage::LunCmd::Istgt::get_base; | ||||
|      } elsif ($scfg->{iscsiprovider} eq 'iet') { | ||||
|          return PVE::Storage::LunCmd::Iet::get_base; | ||||
| @@ -39,6 +40,8 @@
 | ||||
| 
 | ||||
|      if ($scfg->{iscsiprovider} eq 'comstar') { | ||||
|          return PVE::Storage::LunCmd::Comstar::get_base; | ||||
| +    } elsif ($scfg->{iscsiprovider} eq 'freenas') {
 | ||||
| +        return PVE::Storage::LunCmd::FreeNAS::get_base;
 | ||||
|      } else { | ||||
|          $zfs_unknown_scsi_provider->($scfg->{iscsiprovider}); | ||||
|      } | ||||
| @@ -63,6 +66,8 @@
 | ||||
|              $msg = PVE::Storage::LunCmd::Istgt::run_lun_command($scfg, $timeout, $method, @params); | ||||
|      } elsif ($scfg->{iscsiprovider} eq 'istgt') { | ||||
|          return PVE::Storage::LunCmd::Istgt::get_base; | ||||
|      } elsif ($scfg->{iscsiprovider} eq 'iet') { | ||||
|              $msg = PVE::Storage::LunCmd::Iet::run_lun_command($scfg, $timeout, $method, @params); | ||||
| @@ -59,6 +62,8 @@
 | ||||
|      if ($lun_cmds->{$method}) { | ||||
|          if ($scfg->{iscsiprovider} eq 'comstar') { | ||||
|              $msg = PVE::Storage::LunCmd::Comstar::run_lun_command($scfg, $timeout, $method, @params); | ||||
| +        } elsif ($scfg->{iscsiprovider} eq 'freenas') {
 | ||||
| +            $msg = PVE::Storage::LunCmd::FreeNAS::run_lun_command($scfg, $timeout, $method, @params);
 | ||||
|          } else { | ||||
|              $zfs_unknown_scsi_provider->($scfg->{iscsiprovider}); | ||||
|          } elsif ($scfg->{iscsiprovider} eq 'istgt') { | ||||
|              $msg = PVE::Storage::LunCmd::Istgt::run_lun_command($scfg, $timeout, $method, @params); | ||||
|          } elsif ($scfg->{iscsiprovider} eq 'iet') { | ||||
| @@ -188,6 +193,14 @@
 | ||||
|             description => "host group for comstar views", | ||||
|             type => 'string', | ||||
|         }, | ||||
| +        freenas_user => {
 | ||||
| +            description => "FreeNAS API Username",
 | ||||
| +            type => 'string',
 | ||||
| +        },
 | ||||
| +        freenas_password => {
 | ||||
| +            description => "FreeNAS API Password",
 | ||||
| +            type => 'string',
 | ||||
| +        },
 | ||||
|      }; | ||||
|  } | ||||
| 
 | ||||
| @@ -204,6 +217,8 @@
 | ||||
|         sparse => { optional => 1 }, | ||||
|         comstar_hg => { optional => 1 }, | ||||
|         comstar_tg => { optional => 1 }, | ||||
| +        freenas_user => { optional => 1 },
 | ||||
| +        freenas_password => { optional => 1 },
 | ||||
|         content => { optional => 1 }, | ||||
|         bwlimit => { optional => 1 }, | ||||
|      }; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue