aboutsummaryrefslogtreecommitdiffstats
path: root/QMP/vm-info
blob: 8ebaeb38c00a7c20ebf783c9bff8804af6e0aeea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
#
# Print Virtual Machine information
#
# Usage:
#
# Start QEMU with:
#
# $ qemu [...] -monitor control,unix:./qmp,server
#
# Run vm-info:
#
# $ vm-info ./qmp
#
# Luiz Capitulino <lcapitulino@redhat.com>

import qmp
from sys import argv,exit

def main():
    if len(argv) != 2:
        print 'vm-info <unix-socket>'
        exit(1)

    qemu = qmp.QEMUMonitorProtocol(argv[1])
    qemu.connect()

    for cmd in [ 'version', 'kvm', 'status', 'uuid', 'balloon' ]:
        print cmd + ': ' + str(qemu.send('query-' + cmd))

if __name__ == '__main__':
    main()