Luiz Capitulino | 01f2785 | 2009-11-26 22:59:10 -0200 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # |
| 3 | # Print Virtual Machine information |
| 4 | # |
| 5 | # Usage: |
| 6 | # |
| 7 | # Start QEMU with: |
| 8 | # |
| 9 | # $ qemu [...] -monitor control,unix:./qmp,server |
| 10 | # |
| 11 | # Run vm-info: |
| 12 | # |
| 13 | # $ vm-info ./qmp |
| 14 | # |
| 15 | # Luiz Capitulino <lcapitulino@redhat.com> |
| 16 | |
| 17 | import qmp |
| 18 | from sys import argv,exit |
| 19 | |
| 20 | def main(): |
| 21 | if len(argv) != 2: |
| 22 | print 'vm-info <unix-socket>' |
| 23 | exit(1) |
| 24 | |
| 25 | qemu = qmp.QEMUMonitorProtocol(argv[1]) |
| 26 | qemu.connect() |
| 27 | |
| 28 | for cmd in [ 'version', 'hpet', 'kvm', 'status', 'uuid', 'balloon' ]: |
| 29 | print cmd + ': ' + str(qemu.send('query-' + cmd)) |
| 30 | |
| 31 | if __name__ == '__main__': |
| 32 | main() |