Created
November 3, 2017 19:08
-
-
Save dhilst/96ecbba9f26fe5ac33f63f3d89efc536 to your computer and use it in GitHub Desktop.
Xen grab vm metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import XenAPI | |
| from getpass import getpass | |
| host = 'https://localhost' | |
| user = 'root' | |
| password = getpass('Password: ') | |
| session = XenAPI.Session(host) | |
| session.login_with_password(user, password) | |
| for vm in session.xenapi.VM.get_all(): | |
| vmobj = session.xenapi.VM.get_record(vm) | |
| for k, v in vmobj.items(): | |
| print(u'{}: {} => {}'.format( | |
| vmobj['name_label'], k, v)) | |
| session.logout() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment