Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get ESXi management interface? #31

Open
alexfear opened this issue Jun 3, 2014 · 0 comments
Open

How to get ESXi management interface? #31

alexfear opened this issue Jun 3, 2014 · 0 comments

Comments

@alexfear
Copy link

alexfear commented Jun 3, 2014

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"

What am I doing wrong or how do I read that array of data?

Thanks.

@alexfear alexfear closed this as completed Jun 3, 2014
@alexfear alexfear reopened this Jun 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant