2009-11-27 01:59:10 +01:00
|
|
|
#!/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()
|
2010-06-16 00:38:45 +02:00
|
|
|
qemu.send("qmp_capabilities")
|
2009-11-27 01:59:10 +01:00
|
|
|
|
2010-06-13 14:15:46 +02:00
|
|
|
for cmd in [ 'version', 'kvm', 'status', 'uuid', 'balloon' ]:
|
2009-11-27 01:59:10 +01:00
|
|
|
print cmd + ': ' + str(qemu.send('query-' + cmd))
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|