Open alexfear opened 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"
What am I doing wrong or how do I read that array of data?
Thanks.
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.