pci: Remove pci_enable_capability_support()
[qemu-kvm/stefanha.git] / QMP / qmp-shell
bloba5b72d15d1808c8764b11cc93c02992626ecad7f
1 #!/usr/bin/python
3 # Simple QEMU shell on top of QMP
5 # Copyright (C) 2009 Red Hat Inc.
7 # Authors:
8 # Luiz Capitulino <lcapitulino@redhat.com>
10 # This work is licensed under the terms of the GNU GPL, version 2. See
11 # the COPYING file in the top-level directory.
13 # Usage:
15 # Start QEMU with:
17 # $ qemu [...] -monitor control,unix:./qmp,server
19 # Run the shell:
21 # $ qmp-shell ./qmp
23 # Commands have the following format:
25 # < command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ]
27 # For example:
29 # (QEMU) info item=network
31 import qmp
32 import readline
33 from sys import argv,exit
35 def shell_help():
36 print 'bye exit from the shell'
38 def main():
39 if len(argv) != 2:
40 print 'qemu-shell <unix-socket>'
41 exit(1)
43 qemu = qmp.QEMUMonitorProtocol(argv[1])
44 qemu.connect()
45 qemu.send("qmp_capabilities")
47 print 'Connected!'
49 while True:
50 try:
51 cmd = raw_input('(QEMU) ')
52 except EOFError:
53 print
54 break
55 if cmd == '':
56 continue
57 elif cmd == 'bye':
58 break
59 elif cmd == 'help':
60 shell_help()
61 else:
62 try:
63 resp = qemu.send(cmd)
64 if resp == None:
65 print 'Disconnected'
66 break
67 print resp
68 except IndexError:
69 print '-> command format: <command-name> ',
70 print '[arg-name1=arg1] ... [arg-nameN=argN]'
72 if __name__ == '__main__':
73 main()