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

Can't get MAC address for VMware ESXi 5.0 #48

Open
GoogleCodeExporter opened this issue Apr 14, 2015 · 0 comments
Open

Can't get MAC address for VMware ESXi 5.0 #48

GoogleCodeExporter opened this issue Apr 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
class AEsxiServer(object):
    def __init__(self, servername, password,  username='root'):
        self.servername = servername
        self.username = username
        self.password = password
        self.vmlist = []
        self.vmstatusdict = {}
        self.vmmaclist = {}
        self.vmdict = {}
        self.inUseDict = {}

    def connect(self):
        print "connecting to %s" % self.servername
        self.server = VIServer()
        self.server.connect(self.servername, self.username, self.password)
        print "connected to %s" % self.servername
        print "Currently server version is: %s %s" \
            % (self.server.get_server_type(), self.server.get_api_version())

    def get_vmmaclist(self):
        for vmPath in self.get_vmlist():
            vm = self.server.get_vm_by_path(vmPath)
            vminfo = vm.get_properties()
            vmmacinfo = vminfo['mac_address']
            print vmmacinfo

def main():
    print "This is Esxi Server Object"
    S=AEsxiServer('xxxx','xxxx')
    S.connect()
    S.get_vmmaclist()

if __name__ == '__main__':
    main()

results:
print vmmacinfo # it will return "None"

S.get_vmmaclist() will return the following errors
Traceback (most recent call last):
  File "./AsterEsxiServer.py", line 133, in <module>
    main()
  File "./AsterEsxiServer.py", line 125, in main
    asterS.get_vmmaclist()
  File "./AsterEsxiServer.py", line 60, in get_vmmaclist
    vmmacinfo = vminfo['mac_address']
KeyError: 'mac_address'

What is the expected output? What do you see instead?
It should output mac address, but it prompts that don't have the key 
'mac_address'
BTW, I can get 

What version of the product are you using? On what operating system?
RHEL6.5

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 30 Dec 2013 at 6:21

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

No branches or pull requests

1 participant