vmware-archive / rbvmomi

Ruby interface to the VMware vSphere API.
MIT License
302 stars 174 forks source link

selectedVnic method returns corrupted data? #43

Open alexfear opened 10 years ago

alexfear commented 10 years ago

Hi,

My environment: ESXi 5.1 + vCenter 5.1 CentOS 6.4 x64 + ruby 1.9.3p448 + RbVmomi 1.6.0

I've successfully tryed to execute following commands (rails console with rbvmomi library):

opt = {:host=>'myvcenterhost',:user=>'myuser',:password=>'mypassword',:insecure=>true} vim = RbVmomi::VIM.connect opt dc = vim.serviceInstance.find_datacenter("datacenter_name") or fail "datacenter not found" cluster = dc.hostFolder.childEntity.find { |x| x.name == 'cluster_name' } or fail "cluster not found" host = cluster.host.find { |x| x.name == 'host_name' } or fail 'host not found' hostvnicmanager = host.config.virtualNicManagerInfo hostnetconfig = hostvnicmanager.netConfig hostmgmt = hostnetconfig.find { |x| x.nicType == 'management' } or fail 'not found' hostmgmtvnics = hostmgmt.selectedVnic

But all I've got at the last step is array of data which doesn't tell me anything to identify management vmk-s:

irb(main):009:0> hostmgmtvnics = hostmgmt.selectedVnic [2014-06-03 13:09:36 +0300] => [#<RbVmomi::VIM::HostVirtualNic:0x000000094c0168 @props={:dynamicProperty=>[]}>, #<RbVmomi::VIM::HostVirtualNic:0x000000094bf768 @props={:dynamicProperty=>[]}>]

irb(main):010:0> hostmgmtvnics = hostmgmt.selectedVnic[0] [2014-06-03 13:16:01 +0300] => #<RbVmomi::VIM::HostVirtualNic:0x000000094c0168 @props={:dynamicProperty=>[]}>

irb(main):011:0> hostmgmtvnics = hostmgmt.selectedVnic[0].key [2014-06-03 13:19:10 +0300] => nil

Although I can see management interfaces with the MOB browser:

selectedVnic string[]

"management.key-vim.host.VirtualNic-vmk0" "management.key-vim.host.VirtualNic-vmk1"

It seems there's a bug in retrieving list of strings in selectedVnic.

asaenz-vmware commented 10 years ago

This is also an issue for me.

If nothing else, I would like to try and patch it for our own use, but I am having trouble figuring out where exactly in the code this would need to be fixed. Does anybody have any insight?

MiloCheung commented 7 years ago

hi @asaenz and @alexfear , do you have any idea for this problem? or any hints to patch the gem to solve this problem? thanks!

MiloCheung commented 7 years ago

hi @jrgarcia , do you have time take a look? I have no idea why the "selectedVnic" does not return a array of string. It only return a array of "HostVirtualNic" object, but this object doesn't include any info on it. Thanks!

jrgarcia commented 7 years ago

@MiloCheung I'll do my best to take a look today, but it may have to wait until Monday. I'll keep you updated.