VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso
Jump to solution

ESX host WWPN or WWNN are stored as long numbers. How do I work with these values?

I need to update our machine database with the WWPN and WWNN of each ESX host.  These are stored as long integers.  What is the correct way to deal with a long integer like one associated with a 64bit mac?  Is there a mechanism within vRO for this?  If the number was stored as a string I could work with it but when I try to convert it using .toString() I end up with an incorrect value.

1 Solution

Accepted Solutions
thechaos
Enthusiast
Enthusiast
Jump to solution

Hi,

something like this

for( var i = 0; i < HostObject.configManager.storageSystem.storageDeviceInfo.hostBusAdapter.length; i++ )

{

if( hbas[i] instanceof VcHostFibreChannelHba )

{   

           System.debug("nodeWorldWideNameHex :: "+hbas[i].nodeWorldWideNameHex);

           System.debug("portWorldWideNameHex :: "+hbas[i].portWorldWideNameHex);

    }

}

View solution in original post

5 Replies
thechaos
Enthusiast
Enthusiast
Jump to solution

Hi,

something like this

for( var i = 0; i < HostObject.configManager.storageSystem.storageDeviceInfo.hostBusAdapter.length; i++ )

{

if( hbas[i] instanceof VcHostFibreChannelHba )

{   

           System.debug("nodeWorldWideNameHex :: "+hbas[i].nodeWorldWideNameHex);

           System.debug("portWorldWideNameHex :: "+hbas[i].portWorldWideNameHex);

    }

}

qc4vmware
Virtuoso
Virtuoso
Jump to solution

Where are you getting your information?  I am asking how to convert from the very large number > hex.  There are no hex fields as you are referencing although the vCenter client transforms it.  The scriptable objects only have .nodeWorldWideName and .portWorldWideName which are both large numbers.

Here is the api page on the fibre channel hba devices

Screen Shot 2016-04-14 at 10.03.34 AM.png

Since the number is so large javascript barfs on it.  It looks like people write their own libraries to deal with this and I am wondering if vRO already has some way of dealing with these large numbers that I am not aware of.  If I could successfully read in the number I could convert it but it seems to get rounded  or otherwise mangled.

If you have found these already as a hex formatted string in the api please share.  Thanks!

0 Kudos
qc4vmware
Virtuoso
Virtuoso
Jump to solution

Can anyone help with this one?  Seems like this is a bug to me with any plugin returning an integer that is too long for the javascript engine to process.  I worked around it with a powershell call where I can convert the value to a string but we need to account for this sort of thing in the plugin or the plugin framework.

0 Kudos
dvatov
VMware Employee
VMware Employee
Jump to solution

I think there are two getters in VcHostFibreChannelHba  - getPortWorldWideNameHex(), getNodeWorldWideNameHex() that will format this number as string. They are not part of the vCenter API but added by the vRO plugin.

qc4vmware
Virtuoso
Virtuoso
Jump to solution

Argh... I was only looking at the api docs... I didn't see the additional getters on the plugin.  Thanks everyone!

0 Kudos