diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2009-11-26 22:59:10 -0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-12-03 09:41:25 -0600 |
commit | 01f2785ed7f316a48ed719e215bfa15b08d2d8da (patch) | |
tree | 997f3014526ae2e5c80e23a7fb9d29fa682cfbf1 /QMP | |
parent | cedebdacd2307a3e4df9aec9839b12895c25e5f5 (diff) | |
download | qemu-01f2785ed7f316a48ed719e215bfa15b08d2d8da.tar.gz qemu-01f2785ed7f316a48ed719e215bfa15b08d2d8da.tar.bz2 qemu-01f2785ed7f316a48ed719e215bfa15b08d2d8da.zip |
QMP: Introduce vm-info
A Python script which uses qmp.py to print some simple VM info.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'QMP')
-rwxr-xr-x | QMP/vm-info | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/QMP/vm-info b/QMP/vm-info new file mode 100755 index 0000000000..b150d8240c --- /dev/null +++ b/QMP/vm-info @@ -0,0 +1,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', 'hpet', 'kvm', 'status', 'uuid', 'balloon' ]: + print cmd + ': ' + str(qemu.send('query-' + cmd)) + +if __name__ == '__main__': + main() |