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

Sometimes the API will return no data for specific properties even though it should #20

Closed
embodyhumility opened this issue Mar 7, 2014 · 7 comments
Labels

Comments

@embodyhumility
Copy link

I wrote a python program to query the vm.guest.net property so I could get all of the MAC addresses for all VM's. Most of the time, the program will return the correct results, however, sometimes the program will return nothing for vm.guest.net, yet the VM has not changed in any way. If I restart vCenter, the program will again return all of the correct data.

I have seen this same behavior with other properties but vm.guest.net seems to be the most prone to failure.

To test this, you can write a program to record all of the MAC's for each VM in the infrastructure and you will find over the course of a month one or more of those calls will return nothing.

Thanks, I hope this was clear and you can fix the bug.

Best,

Dave

@hartsock
Copy link
Member

Dave, any chance I might get you to write a sample script and post it on gist? It would help me reproduce the issue and nail down what's going wrong.

@embodyhumility
Copy link
Author

Yes I would be happy to do that for you! Give me until tomorrow.

Best,

Dave

From: Shawn Hartsock [mailto:[email protected]]
Sent: Monday, March 10, 2014 9:41 AM
To: vmware/pyvmomi
Cc: Dave Durkee
Subject: Re: [pyvmomi] Sometimes the API will return no data for specific properties even though it should (#20)

Dave, any chance I might get you to write a sample script and post it on gist? It would help me reproduce the issue and nail down what's going wrong.


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-37196335.

@hartsock
Copy link
Member

No rush. I have quite a bit of behind the scenes work to do on this project yet before we can ramp up public development from here.

@pmitoraj
Copy link

pmitoraj commented Apr 6, 2014

Could be related: #24

@embodyhumility
Copy link
Author

I wrote a samples program to retrieve all of the MAC addresses for all VM's in VC. What I am seeing is the program sometime fails to return MAC addresses for certain VM's regardless of the power state.

#!/usr/bin/python

import pyVmomi
from pyVim.connect import SmartConnect, Disconnect

def PrintVmInfo(vm, depth=1):
"""
Print information for a particular virtual machine or recurse into a folder with depth protection
"""
maxdepth = 10

if this is a group it will have children. if it does, recurse into them and then return

if hasattr(vm, 'childEntity'):
if depth > maxdepth:
return
vmList = vm.childEntity
for c in vmList:
PrintVmInfo(c, depth+1)
return

summary = vm.summary
guest = vm.guest
mac = list()

if guest != None:
for net in guest.net:
mac.append(net.macAddress)
print '%s|%s|%s' % (summary.config.name,summary.runtime.powerState,mac)

si = SmartConnect(host='1.1.1.1',user='yyyy',pwd='xxxxxx',port=443)
content = si.RetrieveContent()
datacenter = content.rootFolder.childEntity[0]
vmFolder = datacenter.vmFolder
vmList = vmFolder.childEntity
for vm in vmList:
PrintVmInfo(vm)

Disconnect(si)

Code: https://www.dropbox.com/s/amh8r2vak234mlq/pyvmoni-test.py
Output: https://www.dropbox.com/s/dpx9skj8fwe8s1h/x.xlsx

@hartsock hartsock removed the bug label Aug 19, 2014
hartsock added a commit to hartsock/pyvmomi that referenced this issue Aug 19, 2014
Specifically addresses test coverage of the virtual machine
guest data object. In particular the ability to retrieve the
macAddress attribute.

addresses vmware#20
@hartsock
Copy link
Member

As far as I can tell, this isn't a problem in the pyVmomi library. I've added a test to exercise that code path to demonstrate that the library correctly retrieves mac addresses sent by vCenter.

@srazin
Copy link

srazin commented Dec 2, 2016

Hello!
2 years later but we also running into a similar issue with yavijava (java library) which confirms that it is not py issue (assuming we looking at the same problem which sounds like we do).
After the restart of vCenter everything comes to normal. Also if you connect another system...different IP, it also seem to work (not sure if vCenter in some way also holds the session identity based on the connected MAC...).
Anyone seen this again? Any KB articles @ VMware?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants