VMware Cloud Community
srpursch
Contributor
Contributor

Get-ScsiLun : Object reference not set to an instance of an object

Hi,

This error has been partially discussed before, but none of the suggestions have fixed this issue for us. Get-scsilun runs on some of our hosts, but not others. All of the hosts are on the same version of ESX, VMware ESX 4.0.0 build-261974. I've only been able to find one difference. The hosts that work are using two Emulex LPe1150-e HBAs. The hosts that do not work are using a single Emulex LPe1205-M dual-port HBA.

I'm using VMware vSphere PowerCLI 4.0 U1 build 208462.

Here's the commands I'm running and the exact error:

$vmhost=get-vmhost

$vmhost|get-scsilun -luntype Disk

Get-ScsiLun : Object reference not set to an instance of an object.

At line:1 char:20

+ $vmhost|get-scsilun <<<< -luntype Disk

+ CategoryInfo : NotSpecified: (Smiley Happy , NullReferenceException

+ FullyQualifiedErrorId : System.NullReferenceException,VMware.VimAutomation.VimAutomation.Commands.Host.GetScsiLun

Are there any other suggestions? I saw on another thread that there was a way to submit an SR on Powercli issues. Any info on that would be appreciated as well.

Thanks

Tags (1)
0 Kudos
13 Replies
LucD
Leadership
Leadership

You can open a SR here.

Can you provide the exception and inner-exception like Yasen asked in the other thread ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
srpursch
Contributor
Contributor

Here's the info you requested:

$error[0]

Get-ScsiLun : Object reference not set to an instance of an object.

At line:1 char:20

+ $vmhost|Get-ScsiLun <<<< -LunType disk

+ CategoryInfo : NotSpecified: (Smiley Happy , NullReferenceException

+ FullyQualifiedErrorId : System.NullReferenceException,VMware.VimAutomation.VimAutomation.Commands.Host.GetScsiLun

$error[0].Exception

Object reference not set to an instance of an object.

I could not get anything from $error[0].Exception.InnerException. It shows to be blank.

Thanks for the help.

0 Kudos
LucD
Leadership
Leadership

Doesn't seem to show a lot Smiley Sad

Perhaps Yasen can deduce more from this.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
srpursch
Contributor
Contributor

Yeah... I noticed that it is about the same information that is pumped out to the console when the error happens.

$error[0]|select * produces the following information, if it's helpful:

Exception : System.NullReferenceException: Object reference not set to an instance of an object.

at VMware.VimAutomation.Client20.StorageServiceImpl.GetScsiLunMultipathPolicy(HostStorageDeviceInfo storage DeviceInfo, ScsiLun scsiLun)

at VMware.VimAutomation.Client20.StorageServiceImpl.GetScsiLun(String hostId, ManagedObjectReference hostStorageSystemRef, IEnumerable`1 key, IEnumerable`1 canonicalName, IEnumerable`1 lunType)

at VMware.VimAutomation.Client20.StorageServiceImpl.GetScsiLun(VMHost host, String[] key, String[] canonicalName, String[] lunType)

at VMware.VimAutomation.VimAutomation.Commands.Host.GetScsiLun.DoWork(VIAutomation client, List`1 moList)

at VMware.VimAutomation.BaseCmdlet.DoWorkEx(VIAutomation client, List`1 moList)

at VMware.VimAutomation.Util.ClientVisitor`1.Visit(T [] objs, Worker worker, ErrorCallback errorCallback)

at VMware.VimAutomation.BaseCmdlet.ProcessRecordCore()

at VMware.VimAutomation.BaseCmdlet.ProcessRecord()

at System.Management.Automation.CommandProcessor.ProcessRecord()

TargetObject :

CategoryInfo : NotSpecified: (Smiley Happy , NullReferenceException

FullyQualifiedErrorId : System.NullReferenceException,VMware.VimAutomation.VimAutomation.Commands.Host.GetScsiLun

ErrorDetails :

InvocationInfo : System.Management.Automation.InvocationInfo

PipelineIterationInfo : {1, 1}

$error[0].Exception.Stacktrace is also available if it helps.

0 Kudos
ykalchev
VMware Employee
VMware Employee

Hi,

Thank you for posting Exception details especially the StackTrace it's very helpful to us!

We have a clue for the reason of the issue but to make sure I need some additional info about the environment. Can you please check the content of the MultipathInfo object of the host storage system using the following script:

$vmhost=get-vmhost <servername>
$hostView = $vmhost | Get-View
$hostStorageSystem = Get-view $hostView.ConfigManager.StorageSystem
$hostStorageSystem.StorageDeviceInfo.MultipathInfo

I suspect it's empty but if it's not, can you please check content of the Lun policy property also:

 $s.StorageDeviceInfo.MultipathInfo | %{$_.Lun} |  %{$_.Policy}

Thanks in advance,

Yasen

Yasen Kalchev, vSM Dev Team
0 Kudos
srpursch
Contributor
Contributor

Yasen,

Thanks for the help. The multipath info is not empty. It does show all of the lun devices. The LUN policies also show up correctly with the two local drives as fixed and the SAN storage as MRU:

$hoststoragesystem.StorageDeviceInfo.MultipathInfo|%{$_.LUN}|%{$_.policy}

Policy DynamicType DynamicProperty

-


-


-


VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_FIXED

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_MRU

VMW_PSP_FIXED

VMW_PSP_MRU

0 Kudos
srpursch
Contributor
Contributor

Yasen,

Let me know if you need additional information. Also, our BCS support contact submitted SR 1539350711 on Friday for this issue. i'm not sure whether or not that helps you in any way.

Thanks,

Sam

0 Kudos
ykalchev
VMware Employee
VMware Employee

Hi Sam,

Sorry for the late response we're trying to reproduce the problem on our test environment but with no success.

However we isolated the piece of code that cause the problem and we'll fixed it for the future release. Unfortunately I can't suggest workaround for the cmdlet itself so I've written a script that returns that same data as Get-ScsiLun cmdlet.

Please check the attached script and let me know if it'll work for you or give me some more details for your particular use case.

Also please let me know if you get error "MultipathInfo for xxxx not found" since this is the lun that cause cmdlet to crash.

Regards,

Yasen

PowerCLI Dev Team

Message was edited by: ykalchev

Yasen Kalchev, vSM Dev Team
0 Kudos
srpursch
Contributor
Contributor

Yaser,

I appreciate your continued help. I tried this script and it did return the information as well as the multipathinfo error. I should have specified my specific use case earlier. Here's my situation:

Our environment attaches to some Clariion storage. Since we've upgraded to vSphere 4, it seems all of the luns are going down the same path and using only one of the storage processors. I've modified a script I found on the internet to change the policy to Fixed and point to a certain path, then change the policy back to MRU. So I'm taking the data returned from get-scsilun for the specific luns I need to change and piping that in to set-scsilun. While the script you wrote does return the data, I'm still unable to pipe that back into set-scsilun to make the necessary changes. If there's a way to do this, please let me know. Otherwise, I'll have to go through the client and manually change all of the luns to fixed, select the path, then switch back to MRU.

Most of the information I've read suggests using RoundRobin instead, but we've been given the direction to use MRU.

Thanks,

Sam

0 Kudos
ykalchev
VMware Employee
VMware Employee

Hi,

You can still can configure multipathinfo if you use SetMultipathLunPolicy SDK method.

Check the attached script and let me know if have any problems or questions.

Regards,

Yasen Kalchev

PowerCLI Dev Team

Yasen Kalchev, vSM Dev Team
0 Kudos
srpursch
Contributor
Contributor

Yasen,

We had an issue last week that forced me to change all of the lun paths to fixed using the client. With just a few tweaks, I was able to use this script to change the policy back to MRU for all of the luns.

If the get-scsilun bug is to be fixed in the next release, I'll mark this thread as answered. BTW... What is an ETA for the next release?

For reference (and anyone else who uses this script), I had to change the function get-scsilundata due to a slight typo:

function Get-ScsiLunData($storageDeviceInfo) {

$scsiLun = $null;

Get host scsi lun info

foreach($scsiLunInfo in $StorageDeviceInfo.ScsiLun) {

if ($scsiLunInfo.CanonicalName -eq $CanonicalName) {

$scsiLun = $scsiLunInfo

break;

}

}

if ($scsiLun -eq $null) {

Write-Error "ScsiLun $CanonicalName not found"

}

return $scsiLun

}

You could also replace the foreach section of this function with the line: $scsilun=$storageDeviceInfo.scsilun|?{$_.canonicalname -eq $CanonicalName}

Thanks for the help,

Sam

0 Kudos
ykalchev
VMware Employee
VMware Employee

Hi Sam,

Thanks for the feedback.I've uploaded the correct script if someone hits the same issue. Unfortunately we found the problem too late to be included in the PowerCLI 4.1 release which is already available for download.

However the issue has been logged and fixed for the future release.

Regards,

Yasen Kalchev

PowerCLI Dev Team

Yasen Kalchev, vSM Dev Team
0 Kudos
sbuhk
Contributor
Contributor

I had this similar issue and was able to "resolve" it by disconnecting my KVM/IP session to the host that was having a problem, I suspect having this session open caused an issue with other v4.x hosts on the network.

0 Kudos