Change iscsi_lunid values of 'undef' to 0 (zero)
- In FreeNAS 11.1 it seems like a Lun of 0 becomes 'Auto'. When the API returns the targent_to_extent data any Lun of "Auto" become 'undef' and causes issues and errors in the syslog. This change corrects this behavior. Have tested with adding, detaching, removing and "Moving Disk" functions of Proxmox version 5.1-51.
This commit is contained in:
		
							parent
							
								
									6931f4a232
								
							
						
					
					
						commit
						af42dfd008
					
				|  | @ -359,6 +359,15 @@ sub freenas_iscsi_get_target_to_extent { | ||||||
|     if ($code == 200) { |     if ($code == 200) { | ||||||
|         my $result = decode_json($client->responseContent()); |         my $result = decode_json($client->responseContent()); | ||||||
|         syslog("info","FreeNAS::API::get_target_to_extent() : sucessfull"); |         syslog("info","FreeNAS::API::get_target_to_extent() : sucessfull"); | ||||||
|  |         # If 'iscsi_lunid' is undef then it is set to 'Auto' in FreeNAS | ||||||
|  |         # which should be '0' in our eyes. | ||||||
|  |         # This gave Proxmox 5.x and FreeNAS 11.1 a few issues. | ||||||
|  |         foreach my $item (@$result) { | ||||||
|  |             if (!defined($item->{'iscsi_lunid'})) { | ||||||
|  |                 $item->{'iscsi_lunid'} = 0; | ||||||
|  |                 syslog("info", "FreeNAS::API::get_target_to_extent() : change undef iscsi_lunid to 0"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         return $result; |         return $result; | ||||||
|     } else { |     } else { | ||||||
|         freenas_api_log_error($client, "get_target_to_extent"); |         freenas_api_log_error($client, "get_target_to_extent"); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue