Is there a way to get the IPStack for a vm in vmware? Particularly using pyvmomi for python
https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.vm.GuestInfo.html#field_detail no longer shows ip stack and vm.summary returns a large list of info including a single IP and each network card, but not which ip each card is connected to.
https://github.com/vmware/pyvmomi/issues/769 seems to show that at some point there was an output that included the IPStack.
I have MANY vms with more than one ip address viewable when you log into the vcenters via their html interface. Each IP is viewable, and using the mob, you can access
VIRTUALCENTERNAME/mob/?moid=vm%2dVM_NUMBER&doPath=guest%2eipStack I can see the info I want, but how can I pull this via python
Code snippet:
si = SmartConnectNoSSL(host=MY_VCENTER, user='MYUSERNAME',pwd=MYPASSWORD, port=MYPORT)
atexit.register(Disconnect, si)
content = si.RetrieveServiceContent()
container = content.rootFolder
recursive = True
viewTypeComputeResource = [vim.ComputeResource]
containerView = content.viewManager.CreateContainerView(container, viewTypeComputeResource, recursive) # create container view
clusters = containerView.view
for cluster in clusters:
hosts = cluster.host
for each_host in hosts:
vms = each_host.vm
for vm in vms:
print(vm.summary)
This code runs and gets you from the root folder to the vms and their summaries, which provide guest info, ethernet info etc. I would assume vm.summary.guestInfo (or varying caps and non caps) would help but didnt.