VMware {code} Community
oleksandrantono
Enthusiast
Enthusiast

How to get ESXi management interface through the API (java)

Hi community,

My environment:

ESXi 5.1 + vCenter 5.1

CentOS 6.4 x64 + ruby 1.9.3p448 + RbVmomi 1.6.0

I cannot get ESXi management interfaces with java SDK.

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

opt = {:host=>'',:user=>'',:password=>'',: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 says to me nothing:


irb(main):057:0> hostmgmtvnics = hostmgmt.selectedVnic

[2014-06-02 17:40:39 +0300] => [#<RbVmomi::VIM::HostVirtualNic:0x00000013cc2d70 @props={:dynamicProperty=>[]}>]

Although I can see management interfaces with the MOB browser:

selectedVnicstring[]
"management.key-vim.host.VirtualNic-vmk0"
"management.key-vim.host.VirtualNic-vmk1"

What am I doing wrong or how do I read that array of data? Any ideas are appreciated.

Thanks for your time!

0 Kudos
1 Reply
oleksandrantono
Enthusiast
Enthusiast

I found out that it's a bug of rbvmomi v1.6 library.

0 Kudos