You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great @dougm
You made me see that I was doing wrong actually. Since I retrieved only Summary, I needed to use vm.Summary.Vm.Reference() instead vm.Network then retrieve this reference for finally get network.
pc := property.DefaultCollector(c)
var vm mo.VirtualMachine
err := pc.RetrieveOne(ctx, vm.Summary.Vm.Reference(), []string{"network"}, &vm)
if err != nil {
return nil, err
}
if len(vm.Network) == 0 {
return nil, nil
}
var nets []mo.Network
err = pc.Retrieve(ctx, vm.Network, []string{"name"}, &nets)
if err != nil {
return nil, err
}
for _, net := range nets {
name := strings.Replace(net.Name, ".", "_", -1)
outputNetworkNames.Put("name", name)
}
amandahla
pushed a commit
to estaleiro/govmomi
that referenced
this issue
Nov 23, 2017
I'm collecting vms like this:
Then I want to see the network names from which VM and made like this:
Then I got:
I don't know why this is happening here. Any help?
The text was updated successfully, but these errors were encountered: