Revision 4cdbc094

b/QMP/README
19 19
o qmp-commands.txt  QMP supported commands (auto-generated at build-time)
20 20
o qmp-events.txt    List of available asynchronous events
21 21

  
22
There are also two simple Python scripts available:
23

  
24
o qmp-shell  A shell
25
o vm-info    Show some information about the Virtual Machine
22
There is also a simple Python script called 'qmp-shell' available.
26 23

  
27 24
IMPORTANT: It's strongly recommended to read the 'Stability Considerations'
28 25
section in the qmp-commands.txt file before making any serious use of QMP.
/dev/null
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
    qemu.send("qmp_capabilities")
28

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

  
32
if __name__ == '__main__':
33
    main()

Also available in: Unified diff