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
 | 
					--- ZFSPlugin.pm.orig   2018-04-17 09:52:36.917394028 -0400
 | 
				
			||||||
+++ mountpoint/PVE/Storage/ZFSPlugin.pm	2017-05-17 15:24:07.000000000 +0200
 | 
					+++ ZFSPlugin.pm        2018-04-18 14:20:52.711457607 -0400
 | 
				
			||||||
@@ -12,6 +12,7 @@
 | 
					@@ -10,6 +10,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 use base qw(PVE::Storage::ZFSPoolPlugin);
 | 
				
			||||||
 use PVE::Storage::LunCmd::Comstar;
 | 
					 use PVE::Storage::LunCmd::Comstar;
 | 
				
			||||||
 | 
					+use PVE::Storage::LunCmd::FreeNAS;
 | 
				
			||||||
 use PVE::Storage::LunCmd::Istgt;
 | 
					 use PVE::Storage::LunCmd::Istgt;
 | 
				
			||||||
 use PVE::Storage::LunCmd::Iet;
 | 
					 use PVE::Storage::LunCmd::Iet;
 | 
				
			||||||
+use PVE::Storage::LunCmd::FreeNAS;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 my @ssh_opts = ('-o', 'BatchMode=yes');
 | 
					 | 
				
			||||||
@@ -31,7 +32,7 @@
 | 
					@@ -31,7 +32,7 @@
 | 
				
			||||||
 my $zfs_unknown_scsi_provider = sub {
 | 
					 my $zfs_unknown_scsi_provider = sub {
 | 
				
			||||||
     my ($provider) = @_;
 | 
					     my ($provider) = @_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-    die "$provider: unknown iscsi provider. Available [comstar, istgt, iet]";
 | 
					-    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 {
 | 
					 my $zfs_get_base = sub {
 | 
				
			||||||
@@ -43,6 +44,8 @@
 | 
					@@ -39,6 +40,8 @@
 | 
				
			||||||
         return PVE::Storage::LunCmd::Istgt::get_base;
 | 
					
 | 
				
			||||||
     } elsif ($scfg->{iscsiprovider} eq 'iet') {
 | 
					     if ($scfg->{iscsiprovider} eq 'comstar') {
 | 
				
			||||||
         return PVE::Storage::LunCmd::Iet::get_base;
 | 
					         return PVE::Storage::LunCmd::Comstar::get_base;
 | 
				
			||||||
+    } elsif ($scfg->{iscsiprovider} eq 'freenas') {
 | 
					+    } elsif ($scfg->{iscsiprovider} eq 'freenas') {
 | 
				
			||||||
+        return PVE::Storage::LunCmd::FreeNAS::get_base;
 | 
					+        return PVE::Storage::LunCmd::FreeNAS::get_base;
 | 
				
			||||||
     } else {
 | 
					     } elsif ($scfg->{iscsiprovider} eq 'istgt') {
 | 
				
			||||||
         $zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
 | 
					         return PVE::Storage::LunCmd::Istgt::get_base;
 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
@@ -63,6 +66,8 @@
 | 
					 | 
				
			||||||
             $msg = PVE::Storage::LunCmd::Istgt::run_lun_command($scfg, $timeout, $method, @params);
 | 
					 | 
				
			||||||
     } elsif ($scfg->{iscsiprovider} eq 'iet') {
 | 
					     } 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') {
 | 
					+        } elsif ($scfg->{iscsiprovider} eq 'freenas') {
 | 
				
			||||||
+            $msg = PVE::Storage::LunCmd::FreeNAS::run_lun_command($scfg, $timeout, $method, @params);
 | 
					+            $msg = PVE::Storage::LunCmd::FreeNAS::run_lun_command($scfg, $timeout, $method, @params);
 | 
				
			||||||
         } else {
 | 
					         } elsif ($scfg->{iscsiprovider} eq 'istgt') {
 | 
				
			||||||
             $zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
 | 
					             $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