mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging
Python queue, 2018-06-11 * Make code compatible with Python 3 using 'futurize --stage1' * Require Python >= 2.7 and remove Python 2.6 compatibility modules # gpg: Signature made Mon 11 Jun 2018 18:41:26 BST # gpg: using RSA key 2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/python-next-pull-request: python: Remove scripts/ordereddict.py python: Remove scripts/argparse.py configure: Require Python 2.7 or newer python: futurize -f lib2to3.fixes.fix_numliterals python: futurize -f lib2to3.fixes.fix_except python: futurize -f lib2to3.fixes.fix_renames python: futurize -f lib2to3.fixes.fix_tuple_params python: futurize -f lib2to3.fixes.fix_reduce python: futurize -f lib2to3.fixes.fix_standarderror python: futurize -f lib2to3.fixes.fix_has_key python: futurize -f libfuturize.fixes.fix_next_call python: futurize -f libfuturize.fixes.fix_absolute_import python: futurize -f libfuturize.fixes.fix_print_with_import Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -567,7 +567,6 @@ $(SRC_PATH)/scripts/qapi/types.py \
|
||||
$(SRC_PATH)/scripts/qapi/visit.py \
|
||||
$(SRC_PATH)/scripts/qapi/common.py \
|
||||
$(SRC_PATH)/scripts/qapi/doc.py \
|
||||
$(SRC_PATH)/scripts/ordereddict.py \
|
||||
$(SRC_PATH)/scripts/qapi-gen.py
|
||||
|
||||
qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
|
||||
|
||||
@@ -1651,8 +1651,8 @@ fi
|
||||
|
||||
# Note that if the Python conditional here evaluates True we will exit
|
||||
# with status 1 which is a shell 'false' value.
|
||||
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6))'; then
|
||||
error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \
|
||||
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
|
||||
error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \
|
||||
"Use --python=/path/to/python to specify a supported Python."
|
||||
fi
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid>
|
||||
#
|
||||
# Author: Harsh Prateek Bora
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import simpletrace
|
||||
|
||||
@@ -79,135 +80,135 @@ symbol_9p = {
|
||||
|
||||
class VirtFSRequestTracker(simpletrace.Analyzer):
|
||||
def begin(self):
|
||||
print "Pretty printing 9p simpletrace log ..."
|
||||
print("Pretty printing 9p simpletrace log ...")
|
||||
|
||||
def v9fs_rerror(self, tag, id, err):
|
||||
print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")"
|
||||
print("RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")")
|
||||
|
||||
def v9fs_version(self, tag, id, msize, version):
|
||||
print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
|
||||
print("TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")
|
||||
|
||||
def v9fs_version_return(self, tag, id, msize, version):
|
||||
print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
|
||||
print("RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")
|
||||
|
||||
def v9fs_attach(self, tag, id, fid, afid, uname, aname):
|
||||
print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
|
||||
print("TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")")
|
||||
|
||||
def v9fs_attach_return(self, tag, id, type, version, path):
|
||||
print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
|
||||
print("RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})")
|
||||
|
||||
def v9fs_stat(self, tag, id, fid):
|
||||
print "TSTAT (tag =", tag, ", fid =", fid, ")"
|
||||
print("TSTAT (tag =", tag, ", fid =", fid, ")")
|
||||
|
||||
def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
|
||||
print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
|
||||
print("RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")")
|
||||
|
||||
def v9fs_getattr(self, tag, id, fid, request_mask):
|
||||
print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
|
||||
print("TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")")
|
||||
|
||||
def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
|
||||
print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
|
||||
print("RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")")
|
||||
|
||||
def v9fs_walk(self, tag, id, fid, newfid, nwnames):
|
||||
print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
|
||||
print("TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")")
|
||||
|
||||
def v9fs_walk_return(self, tag, id, nwnames, qids):
|
||||
print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
|
||||
print("RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")")
|
||||
|
||||
def v9fs_open(self, tag, id, fid, mode):
|
||||
print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
|
||||
print("TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")")
|
||||
|
||||
def v9fs_open_return(self, tag, id, type, version, path, iounit):
|
||||
print "ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
|
||||
print("ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
|
||||
|
||||
def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
|
||||
print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
|
||||
print("TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")")
|
||||
|
||||
def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
|
||||
print "RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
|
||||
print("RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
|
||||
|
||||
def v9fs_fsync(self, tag, id, fid, datasync):
|
||||
print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
|
||||
print("TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")")
|
||||
|
||||
def v9fs_clunk(self, tag, id, fid):
|
||||
print "TCLUNK (tag =", tag, ", fid =", fid, ")"
|
||||
print("TCLUNK (tag =", tag, ", fid =", fid, ")")
|
||||
|
||||
def v9fs_read(self, tag, id, fid, off, max_count):
|
||||
print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
|
||||
print("TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")")
|
||||
|
||||
def v9fs_read_return(self, tag, id, count, err):
|
||||
print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
|
||||
print("RREAD (tag =", tag, ", count =", count, ", err =", err, ")")
|
||||
|
||||
def v9fs_readdir(self, tag, id, fid, offset, max_count):
|
||||
print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
|
||||
print("TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")")
|
||||
|
||||
def v9fs_readdir_return(self, tag, id, count, retval):
|
||||
print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
|
||||
print("RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")")
|
||||
|
||||
def v9fs_write(self, tag, id, fid, off, count, cnt):
|
||||
print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
|
||||
print("TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")")
|
||||
|
||||
def v9fs_write_return(self, tag, id, total, err):
|
||||
print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
|
||||
print("RWRITE (tag =", tag, ", total =", total, ", err =", err, ")")
|
||||
|
||||
def v9fs_create(self, tag, id, fid, name, perm, mode):
|
||||
print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
|
||||
print("TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")")
|
||||
|
||||
def v9fs_create_return(self, tag, id, type, version, path, iounit):
|
||||
print "RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
|
||||
print("RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
|
||||
|
||||
def v9fs_symlink(self, tag, id, fid, name, symname, gid):
|
||||
print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
|
||||
print("TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")")
|
||||
|
||||
def v9fs_symlink_return(self, tag, id, type, version, path):
|
||||
print "RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
|
||||
print("RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})")
|
||||
|
||||
def v9fs_flush(self, tag, id, flush_tag):
|
||||
print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
|
||||
print("TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")")
|
||||
|
||||
def v9fs_link(self, tag, id, dfid, oldfid, name):
|
||||
print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
|
||||
print("TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")")
|
||||
|
||||
def v9fs_remove(self, tag, id, fid):
|
||||
print "TREMOVE (tag =", tag, ", fid =", fid, ")"
|
||||
print("TREMOVE (tag =", tag, ", fid =", fid, ")")
|
||||
|
||||
def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
|
||||
print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
|
||||
print("TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")")
|
||||
|
||||
def v9fs_mknod(self, tag, id, fid, mode, major, minor):
|
||||
print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
|
||||
print("TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")")
|
||||
|
||||
def v9fs_lock(self, tag, id, fid, type, start, length):
|
||||
print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
|
||||
print("TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")
|
||||
|
||||
def v9fs_lock_return(self, tag, id, status):
|
||||
print "RLOCK (tag =", tag, ", status =", status, ")"
|
||||
print("RLOCK (tag =", tag, ", status =", status, ")")
|
||||
|
||||
def v9fs_getlock(self, tag, id, fid, type, start, length):
|
||||
print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
|
||||
print("TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")
|
||||
|
||||
def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
|
||||
print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")"
|
||||
print("RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")")
|
||||
|
||||
def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
|
||||
print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
|
||||
print("TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")")
|
||||
|
||||
def v9fs_mkdir_return(self, tag, id, type, version, path, err):
|
||||
print "RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
|
||||
print("RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")")
|
||||
|
||||
def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
|
||||
print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
|
||||
print("TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")")
|
||||
|
||||
def v9fs_xattrwalk_return(self, tag, id, size):
|
||||
print "RXATTRWALK (tag =", tag, ", xattrsize =", size, ")"
|
||||
print("RXATTRWALK (tag =", tag, ", xattrsize =", size, ")")
|
||||
|
||||
def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
|
||||
print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
|
||||
print("TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")")
|
||||
|
||||
def v9fs_readlink(self, tag, id, fid):
|
||||
print "TREADLINK (tag =", tag, ", fid =", fid, ")"
|
||||
print("TREADLINK (tag =", tag, ", fid =", fid, ")")
|
||||
|
||||
def v9fs_readlink_return(self, tag, id, target):
|
||||
print "RREADLINK (tag =", tag, ", target =", target, ")"
|
||||
print("RREADLINK (tag =", tag, ", target =", target, ")")
|
||||
|
||||
simpletrace.run(VirtFSRequestTracker())
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
# Author: Alex Bennée <alex.bennee@linaro.org>
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import simpletrace
|
||||
import argparse
|
||||
@@ -77,7 +78,7 @@ if __name__ == '__main__':
|
||||
|
||||
# Now dump the individual lock stats
|
||||
for key, val in sorted(analyser.mutex_records.iteritems(),
|
||||
key=lambda (k,v): v["locks"]):
|
||||
key=lambda k_v: k_v[1]["locks"]):
|
||||
print ("Lock: %#x locks: %d, locked: %d, unlocked: %d" %
|
||||
(key, val["locks"], val["locked"], val["unlocked"]))
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import print_function
|
||||
import numpy as np
|
||||
import json
|
||||
import os
|
||||
@@ -162,7 +163,7 @@ class RamSection(object):
|
||||
len = self.file.read64()
|
||||
self.sizeinfo[self.name] = '0x%016x' % len
|
||||
if self.write_memory:
|
||||
print self.name
|
||||
print(self.name)
|
||||
mkdir_p('./' + os.path.dirname(self.name))
|
||||
f = open('./' + self.name, "wb")
|
||||
f.truncate(0)
|
||||
@@ -588,7 +589,7 @@ if args.extract:
|
||||
dump = MigrationDump(args.file)
|
||||
|
||||
dump.read(desc_only = True)
|
||||
print "desc.json"
|
||||
print("desc.json")
|
||||
f = open("desc.json", "wb")
|
||||
f.truncate()
|
||||
f.write(jsonenc.encode(dump.vmsd_desc))
|
||||
@@ -596,7 +597,7 @@ if args.extract:
|
||||
|
||||
dump.read(write_memory = True)
|
||||
dict = dump.getDict()
|
||||
print "state.json"
|
||||
print("state.json")
|
||||
f = open("state.json", "wb")
|
||||
f.truncate()
|
||||
f.write(jsonenc.encode(dict))
|
||||
@@ -605,10 +606,10 @@ elif args.dump == "state":
|
||||
dump = MigrationDump(args.file)
|
||||
dump.read(dump_memory = args.memory)
|
||||
dict = dump.getDict()
|
||||
print jsonenc.encode(dict)
|
||||
print(jsonenc.encode(dict))
|
||||
elif args.dump == "desc":
|
||||
dump = MigrationDump(args.file)
|
||||
dump.read(desc_only = True)
|
||||
print jsonenc.encode(dump.vmsd_desc)
|
||||
print(jsonenc.encode(dump.vmsd_desc))
|
||||
else:
|
||||
raise Exception("Please specify either -x, -d state or -d dump")
|
||||
|
||||
-2406
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@
|
||||
Run QEMU with all combinations of -machine and -device types,
|
||||
check for crashes and unexpected errors.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -554,7 +555,7 @@ def main():
|
||||
tc[k] = v
|
||||
|
||||
if len(binariesToTest(args, tc)) == 0:
|
||||
print >>sys.stderr, "No QEMU binary found"
|
||||
print("No QEMU binary found", file=sys.stderr)
|
||||
parser.print_usage(sys.stderr)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ Authors:
|
||||
This work is licensed under the terms of the GNU GPL, version 2 or later. See
|
||||
the COPYING file in the top-level directory.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import ctypes
|
||||
import struct
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
# consuming CPU cycles. No disk I/O is performed since the ring buffer holds a
|
||||
# fixed-size in-memory trace.
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
|
||||
@@ -77,8 +78,8 @@ def tail_trace():
|
||||
pass
|
||||
|
||||
def usage():
|
||||
print 'Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0]
|
||||
print 'Control the KVM flight recorder tracing.'
|
||||
print('Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0])
|
||||
print('Control the KVM flight recorder tracing.')
|
||||
sys.exit(0)
|
||||
|
||||
def main():
|
||||
@@ -87,15 +88,15 @@ def main():
|
||||
|
||||
cmd = sys.argv[1]
|
||||
if cmd == '--version':
|
||||
print 'kvm_flightrecorder version 1.0'
|
||||
print('kvm_flightrecorder version 1.0')
|
||||
sys.exit(0)
|
||||
|
||||
if not os.path.isdir(tracing_dir):
|
||||
print 'Unable to tracing debugfs directory, try:'
|
||||
print 'mount -t debugfs none /sys/kernel/debug'
|
||||
print('Unable to tracing debugfs directory, try:')
|
||||
print('mount -t debugfs none /sys/kernel/debug')
|
||||
sys.exit(1)
|
||||
if not os.access(tracing_dir, os.W_OK):
|
||||
print 'Unable to write to tracing debugfs directory, please run as root'
|
||||
print('Unable to write to tracing debugfs directory, please run as root')
|
||||
sys.exit(1)
|
||||
|
||||
if cmd == 'start':
|
||||
@@ -105,16 +106,16 @@ def main():
|
||||
try:
|
||||
buffer_size_kb = int(sys.argv[2])
|
||||
except ValueError:
|
||||
print 'Invalid per-cpu trace buffer size in KB'
|
||||
print('Invalid per-cpu trace buffer size in KB')
|
||||
sys.exit(1)
|
||||
write_file(trace_path('buffer_size_kb'), str(buffer_size_kb))
|
||||
print 'Per-CPU ring buffer size set to %d KB' % buffer_size_kb
|
||||
print('Per-CPU ring buffer size set to %d KB' % buffer_size_kb)
|
||||
|
||||
start_tracing()
|
||||
print 'KVM flight recorder enabled'
|
||||
print('KVM flight recorder enabled')
|
||||
elif cmd == 'stop':
|
||||
stop_tracing()
|
||||
print 'KVM flight recorder disabled'
|
||||
print('KVM flight recorder disabled')
|
||||
elif cmd == 'dump':
|
||||
dump_trace()
|
||||
elif cmd == 'tail':
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
# This work is licensed under the terms of the GNU GPL, version 2. See
|
||||
# the COPYING file in the top-level directory.
|
||||
|
||||
from __future__ import print_function
|
||||
MSR_IA32_VMX_BASIC = 0x480
|
||||
MSR_IA32_VMX_PINBASED_CTLS = 0x481
|
||||
MSR_IA32_VMX_PROCBASED_CTLS = 0x482
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
# Copyright (c) 2009 Raymond Hettinger
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
# (the "Software"), to deal in the Software without restriction,
|
||||
# including without limitation the rights to use, copy, modify, merge,
|
||||
# publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
# and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from UserDict import DictMixin
|
||||
|
||||
|
||||
class OrderedDict(dict, DictMixin):
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
if len(args) > 1:
|
||||
raise TypeError('expected at most 1 arguments, got %d' % len(args))
|
||||
try:
|
||||
self.__end
|
||||
except AttributeError:
|
||||
self.clear()
|
||||
self.update(*args, **kwds)
|
||||
|
||||
def clear(self):
|
||||
self.__end = end = []
|
||||
end += [None, end, end] # sentinel node for doubly linked list
|
||||
self.__map = {} # key --> [key, prev, next]
|
||||
dict.clear(self)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if key not in self:
|
||||
end = self.__end
|
||||
curr = end[1]
|
||||
curr[2] = end[1] = self.__map[key] = [key, curr, end]
|
||||
dict.__setitem__(self, key, value)
|
||||
|
||||
def __delitem__(self, key):
|
||||
dict.__delitem__(self, key)
|
||||
key, prev, next = self.__map.pop(key)
|
||||
prev[2] = next
|
||||
next[1] = prev
|
||||
|
||||
def __iter__(self):
|
||||
end = self.__end
|
||||
curr = end[2]
|
||||
while curr is not end:
|
||||
yield curr[0]
|
||||
curr = curr[2]
|
||||
|
||||
def __reversed__(self):
|
||||
end = self.__end
|
||||
curr = end[1]
|
||||
while curr is not end:
|
||||
yield curr[0]
|
||||
curr = curr[1]
|
||||
|
||||
def popitem(self, last=True):
|
||||
if not self:
|
||||
raise KeyError('dictionary is empty')
|
||||
if last:
|
||||
key = reversed(self).next()
|
||||
else:
|
||||
key = iter(self).next()
|
||||
value = self.pop(key)
|
||||
return key, value
|
||||
|
||||
def __reduce__(self):
|
||||
items = [[k, self[k]] for k in self]
|
||||
tmp = self.__map, self.__end
|
||||
del self.__map, self.__end
|
||||
inst_dict = vars(self).copy()
|
||||
self.__map, self.__end = tmp
|
||||
if inst_dict:
|
||||
return (self.__class__, (items,), inst_dict)
|
||||
return self.__class__, (items,)
|
||||
|
||||
def keys(self):
|
||||
return list(self)
|
||||
|
||||
setdefault = DictMixin.setdefault
|
||||
update = DictMixin.update
|
||||
pop = DictMixin.pop
|
||||
values = DictMixin.values
|
||||
items = DictMixin.items
|
||||
iterkeys = DictMixin.iterkeys
|
||||
itervalues = DictMixin.itervalues
|
||||
iteritems = DictMixin.iteritems
|
||||
|
||||
def __repr__(self):
|
||||
if not self:
|
||||
return '%s()' % (self.__class__.__name__,)
|
||||
return '%s(%r)' % (self.__class__.__name__, self.items())
|
||||
|
||||
def copy(self):
|
||||
return self.__class__(self)
|
||||
|
||||
@classmethod
|
||||
def fromkeys(cls, iterable, value=None):
|
||||
d = cls()
|
||||
for key in iterable:
|
||||
d[key] = value
|
||||
return d
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, OrderedDict):
|
||||
if len(self) != len(other):
|
||||
return False
|
||||
for p, q in zip(self.items(), other.items()):
|
||||
if p != q:
|
||||
return False
|
||||
return True
|
||||
return dict.__eq__(self, other)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
@@ -16,10 +16,7 @@ import errno
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except:
|
||||
from ordereddict import OrderedDict
|
||||
from collections import OrderedDict
|
||||
|
||||
builtin_types = {
|
||||
'null': 'QTYPE_QNULL',
|
||||
|
||||
@@ -36,10 +36,12 @@
|
||||
# See also: https://wiki.qemu.org/Features/QAPI/GuestAgent
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
import base64
|
||||
import random
|
||||
|
||||
import qmp
|
||||
from . import qmp
|
||||
|
||||
|
||||
class QemuGuestAgent(qmp.QEMUMonitorProtocol):
|
||||
@@ -135,7 +137,7 @@ class QemuGuestAgentClient:
|
||||
|
||||
def fsfreeze(self, cmd):
|
||||
if cmd not in ['status', 'freeze', 'thaw']:
|
||||
raise StandardError('Invalid command: ' + cmd)
|
||||
raise Exception('Invalid command: ' + cmd)
|
||||
|
||||
return getattr(self.qga, 'fsfreeze' + '_' + cmd)()
|
||||
|
||||
@@ -144,7 +146,7 @@ class QemuGuestAgentClient:
|
||||
|
||||
def suspend(self, mode):
|
||||
if mode not in ['disk', 'ram', 'hybrid']:
|
||||
raise StandardError('Invalid mode: ' + mode)
|
||||
raise Exception('Invalid mode: ' + mode)
|
||||
|
||||
try:
|
||||
getattr(self.qga, 'suspend' + '_' + mode)()
|
||||
@@ -155,7 +157,7 @@ class QemuGuestAgentClient:
|
||||
|
||||
def shutdown(self, mode='powerdown'):
|
||||
if mode not in ['powerdown', 'halt', 'reboot']:
|
||||
raise StandardError('Invalid mode: ' + mode)
|
||||
raise Exception('Invalid mode: ' + mode)
|
||||
|
||||
try:
|
||||
self.qga.shutdown(mode=mode)
|
||||
|
||||
+13
-11
@@ -10,8 +10,10 @@
|
||||
# This work is licensed under the terms of the GNU GPLv2 or later.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
import sys, os
|
||||
from qmp import QEMUMonitorProtocol
|
||||
from .qmp import QEMUMonitorProtocol
|
||||
|
||||
def print_response(rsp, prefix=[]):
|
||||
if type(rsp) == list:
|
||||
@@ -26,15 +28,15 @@ def print_response(rsp, prefix=[]):
|
||||
print_response(rsp[key], prefix + [key])
|
||||
else:
|
||||
if len(prefix):
|
||||
print '%s: %s' % ('.'.join(prefix), rsp)
|
||||
print('%s: %s' % ('.'.join(prefix), rsp))
|
||||
else:
|
||||
print '%s' % (rsp)
|
||||
print('%s' % (rsp))
|
||||
|
||||
def main(args):
|
||||
path = None
|
||||
|
||||
# Use QMP_PATH if it's set
|
||||
if os.environ.has_key('QMP_PATH'):
|
||||
if 'QMP_PATH' in os.environ:
|
||||
path = os.environ['QMP_PATH']
|
||||
|
||||
while len(args):
|
||||
@@ -53,21 +55,21 @@ def main(args):
|
||||
elif arg in ['help']:
|
||||
os.execlp('man', 'man', 'qmp')
|
||||
else:
|
||||
print 'Unknown argument "%s"' % arg
|
||||
print('Unknown argument "%s"' % arg)
|
||||
|
||||
args = args[1:]
|
||||
else:
|
||||
break
|
||||
|
||||
if not path:
|
||||
print "QMP path isn't set, use --path=qmp-monitor-address or set QMP_PATH"
|
||||
print("QMP path isn't set, use --path=qmp-monitor-address or set QMP_PATH")
|
||||
return 1
|
||||
|
||||
if len(args):
|
||||
command, args = args[0], args[1:]
|
||||
else:
|
||||
print 'No command found'
|
||||
print 'Usage: "qmp [--path=qmp-monitor-address] qmp-cmd arguments"'
|
||||
print('No command found')
|
||||
print('Usage: "qmp [--path=qmp-monitor-address] qmp-cmd arguments"')
|
||||
return 1
|
||||
|
||||
if command in ['help']:
|
||||
@@ -78,7 +80,7 @@ def main(args):
|
||||
|
||||
def do_command(srv, cmd, **kwds):
|
||||
rsp = srv.cmd(cmd, kwds)
|
||||
if rsp.has_key('error'):
|
||||
if 'error' in rsp:
|
||||
raise Exception(rsp['error']['desc'])
|
||||
return rsp['return']
|
||||
|
||||
@@ -93,7 +95,7 @@ def main(args):
|
||||
os.execvp(fullcmd, [fullcmd] + args)
|
||||
except OSError as exc:
|
||||
if exc.errno == 2:
|
||||
print 'Command "%s" not found.' % (fullcmd)
|
||||
print('Command "%s" not found.' % (fullcmd))
|
||||
return 1
|
||||
raise
|
||||
return 0
|
||||
@@ -104,7 +106,7 @@ def main(args):
|
||||
arguments = {}
|
||||
for arg in args:
|
||||
if not arg.startswith('--'):
|
||||
print 'Unknown argument "%s"' % arg
|
||||
print('Unknown argument "%s"' % arg)
|
||||
return 1
|
||||
|
||||
arg = arg[2:]
|
||||
|
||||
+21
-19
@@ -65,7 +65,9 @@
|
||||
# which will echo back the properly formatted JSON-compliant QMP that is being
|
||||
# sent to QEMU, which is useful for debugging and documentation generation.
|
||||
|
||||
import qmp
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
from . import qmp
|
||||
import json
|
||||
import ast
|
||||
import readline
|
||||
@@ -132,7 +134,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||
|
||||
def _fill_completion(self):
|
||||
cmds = self.cmd('query-commands')
|
||||
if cmds.has_key('error'):
|
||||
if 'error' in cmds:
|
||||
return
|
||||
for cmd in cmds['return']:
|
||||
self._completer.append(cmd['name'])
|
||||
@@ -153,14 +155,14 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||
# File not found. No problem.
|
||||
pass
|
||||
else:
|
||||
print "Failed to read history '%s'; %s" % (self._histfile, e)
|
||||
print("Failed to read history '%s'; %s" % (self._histfile, e))
|
||||
atexit.register(self.__save_history)
|
||||
|
||||
def __save_history(self):
|
||||
try:
|
||||
readline.write_history_file(self._histfile)
|
||||
except Exception as e:
|
||||
print "Failed to save history file '%s'; %s" % (self._histfile, e)
|
||||
print("Failed to save history file '%s'; %s" % (self._histfile, e))
|
||||
|
||||
def __parse_value(self, val):
|
||||
try:
|
||||
@@ -258,15 +260,15 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||
if self._pretty:
|
||||
indent = 4
|
||||
jsobj = json.dumps(qmp, indent=indent)
|
||||
print str(jsobj)
|
||||
print(str(jsobj))
|
||||
|
||||
def _execute_cmd(self, cmdline):
|
||||
try:
|
||||
qmpcmd = self.__build_cmd(cmdline)
|
||||
except Exception as e:
|
||||
print 'Error while parsing command line: %s' % e
|
||||
print 'command format: <command-name> ',
|
||||
print '[arg-name1=arg1] ... [arg-nameN=argN]'
|
||||
print('Error while parsing command line: %s' % e)
|
||||
print('command format: <command-name> ', end=' ')
|
||||
print('[arg-name1=arg1] ... [arg-nameN=argN]')
|
||||
return True
|
||||
# For transaction mode, we may have just cached the action:
|
||||
if qmpcmd is None:
|
||||
@@ -275,7 +277,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||
self._print(qmpcmd)
|
||||
resp = self.cmd_obj(qmpcmd)
|
||||
if resp is None:
|
||||
print 'Disconnected'
|
||||
print('Disconnected')
|
||||
return False
|
||||
self._print(resp)
|
||||
return True
|
||||
@@ -285,12 +287,12 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||
self.__completer_setup()
|
||||
|
||||
def show_banner(self, msg='Welcome to the QMP low-level shell!'):
|
||||
print msg
|
||||
print(msg)
|
||||
if not self._greeting:
|
||||
print 'Connected'
|
||||
print('Connected')
|
||||
return
|
||||
version = self._greeting['QMP']['version']['qemu']
|
||||
print 'Connected to QEMU %d.%d.%d\n' % (version['major'],version['minor'],version['micro'])
|
||||
print('Connected to QEMU %d.%d.%d\n' % (version['major'],version['minor'],version['micro']))
|
||||
|
||||
def get_prompt(self):
|
||||
if self._transmode:
|
||||
@@ -306,11 +308,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||
try:
|
||||
cmdline = raw_input(prompt)
|
||||
except EOFError:
|
||||
print
|
||||
print()
|
||||
return False
|
||||
if cmdline == '':
|
||||
for ev in self.get_events():
|
||||
print ev
|
||||
print(ev)
|
||||
self.clear_events()
|
||||
return True
|
||||
else:
|
||||
@@ -366,24 +368,24 @@ class HMPShell(QMPShell):
|
||||
try:
|
||||
idx = int(cmdline.split()[1])
|
||||
if not 'return' in self.__cmd_passthrough('info version', idx):
|
||||
print 'bad CPU index'
|
||||
print('bad CPU index')
|
||||
return True
|
||||
self.__cpu_index = idx
|
||||
except ValueError:
|
||||
print 'cpu command takes an integer argument'
|
||||
print('cpu command takes an integer argument')
|
||||
return True
|
||||
resp = self.__cmd_passthrough(cmdline, self.__cpu_index)
|
||||
if resp is None:
|
||||
print 'Disconnected'
|
||||
print('Disconnected')
|
||||
return False
|
||||
assert 'return' in resp or 'error' in resp
|
||||
if 'return' in resp:
|
||||
# Success
|
||||
if len(resp['return']) > 0:
|
||||
print resp['return'],
|
||||
print(resp['return'], end=' ')
|
||||
else:
|
||||
# Error
|
||||
print '%s: %s' % (resp['error']['class'], resp['error']['desc'])
|
||||
print('%s: %s' % (resp['error']['class'], resp['error']['desc']))
|
||||
return True
|
||||
|
||||
def show_banner(self):
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
# the COPYING file in the top-level directory.
|
||||
##
|
||||
|
||||
from __future__ import absolute_import
|
||||
import fuse, stat
|
||||
from fuse import Fuse
|
||||
import os, posix
|
||||
from errno import *
|
||||
from qmp import QEMUMonitorProtocol
|
||||
from .qmp import QEMUMonitorProtocol
|
||||
|
||||
fuse.fuse_python_api = (0, 2)
|
||||
|
||||
@@ -28,7 +29,7 @@ class QOMFS(Fuse):
|
||||
self.ino_count = 1
|
||||
|
||||
def get_ino(self, path):
|
||||
if self.ino_map.has_key(path):
|
||||
if path in self.ino_map:
|
||||
return self.ino_map[path]
|
||||
self.ino_map[path] = self.ino_count
|
||||
self.ino_count += 1
|
||||
@@ -89,7 +90,7 @@ class QOMFS(Fuse):
|
||||
|
||||
def getattr(self, path):
|
||||
if self.is_link(path):
|
||||
value = posix.stat_result((0755 | stat.S_IFLNK,
|
||||
value = posix.stat_result((0o755 | stat.S_IFLNK,
|
||||
self.get_ino(path),
|
||||
0,
|
||||
2,
|
||||
@@ -100,7 +101,7 @@ class QOMFS(Fuse):
|
||||
0,
|
||||
0))
|
||||
elif self.is_object(path):
|
||||
value = posix.stat_result((0755 | stat.S_IFDIR,
|
||||
value = posix.stat_result((0o755 | stat.S_IFDIR,
|
||||
self.get_ino(path),
|
||||
0,
|
||||
2,
|
||||
@@ -111,7 +112,7 @@ class QOMFS(Fuse):
|
||||
0,
|
||||
0))
|
||||
elif self.is_property(path):
|
||||
value = posix.stat_result((0644 | stat.S_IFREG,
|
||||
value = posix.stat_result((0o644 | stat.S_IFREG,
|
||||
self.get_ino(path),
|
||||
0,
|
||||
1,
|
||||
|
||||
+7
-5
@@ -11,9 +11,11 @@
|
||||
# the COPYING file in the top-level directory.
|
||||
##
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
import sys
|
||||
import os
|
||||
from qmp import QEMUMonitorProtocol
|
||||
from .qmp import QEMUMonitorProtocol
|
||||
|
||||
cmd, args = sys.argv[0], sys.argv[1:]
|
||||
socket_path = None
|
||||
@@ -33,7 +35,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||
|
||||
if len(args) > 0:
|
||||
if args[0] == "-h":
|
||||
print usage()
|
||||
print(usage())
|
||||
exit(0);
|
||||
elif args[0] == "-s":
|
||||
try:
|
||||
@@ -43,7 +45,7 @@ if len(args) > 0:
|
||||
args = args[2:]
|
||||
|
||||
if not socket_path:
|
||||
if os.environ.has_key('QMP_SOCKET'):
|
||||
if 'QMP_SOCKET' in os.environ:
|
||||
socket_path = os.environ['QMP_SOCKET']
|
||||
else:
|
||||
usage_error("no QMP socket path or address given");
|
||||
@@ -62,6 +64,6 @@ srv.connect()
|
||||
rsp = srv.command('qom-get', path=path, property=prop)
|
||||
if type(rsp) == dict:
|
||||
for i in rsp.keys():
|
||||
print '%s: %s' % (i, rsp[i])
|
||||
print('%s: %s' % (i, rsp[i]))
|
||||
else:
|
||||
print rsp
|
||||
print(rsp)
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
# the COPYING file in the top-level directory.
|
||||
##
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
import sys
|
||||
import os
|
||||
from qmp import QEMUMonitorProtocol
|
||||
from .qmp import QEMUMonitorProtocol
|
||||
|
||||
cmd, args = sys.argv[0], sys.argv[1:]
|
||||
socket_path = None
|
||||
@@ -33,7 +35,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||
|
||||
if len(args) > 0:
|
||||
if args[0] == "-h":
|
||||
print usage()
|
||||
print(usage())
|
||||
exit(0);
|
||||
elif args[0] == "-s":
|
||||
try:
|
||||
@@ -43,7 +45,7 @@ if len(args) > 0:
|
||||
args = args[2:]
|
||||
|
||||
if not socket_path:
|
||||
if os.environ.has_key('QMP_SOCKET'):
|
||||
if 'QMP_SOCKET' in os.environ:
|
||||
socket_path = os.environ['QMP_SOCKET']
|
||||
else:
|
||||
usage_error("no QMP socket path or address given");
|
||||
@@ -52,13 +54,13 @@ srv = QEMUMonitorProtocol(socket_path)
|
||||
srv.connect()
|
||||
|
||||
if len(args) == 0:
|
||||
print '/'
|
||||
print('/')
|
||||
sys.exit(0)
|
||||
|
||||
for item in srv.command('qom-list', path=args[0]):
|
||||
if item['type'].startswith('child<'):
|
||||
print '%s/' % item['name']
|
||||
print('%s/' % item['name'])
|
||||
elif item['type'].startswith('link<'):
|
||||
print '@%s/' % item['name']
|
||||
print('@%s/' % item['name'])
|
||||
else:
|
||||
print '%s' % item['name']
|
||||
print('%s' % item['name'])
|
||||
|
||||
+6
-4
@@ -11,9 +11,11 @@
|
||||
# the COPYING file in the top-level directory.
|
||||
##
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
import sys
|
||||
import os
|
||||
from qmp import QEMUMonitorProtocol
|
||||
from .qmp import QEMUMonitorProtocol
|
||||
|
||||
cmd, args = sys.argv[0], sys.argv[1:]
|
||||
socket_path = None
|
||||
@@ -34,7 +36,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||
|
||||
if len(args) > 0:
|
||||
if args[0] == "-h":
|
||||
print usage()
|
||||
print(usage())
|
||||
exit(0);
|
||||
elif args[0] == "-s":
|
||||
try:
|
||||
@@ -44,7 +46,7 @@ if len(args) > 0:
|
||||
args = args[2:]
|
||||
|
||||
if not socket_path:
|
||||
if os.environ.has_key('QMP_SOCKET'):
|
||||
if 'QMP_SOCKET' in os.environ:
|
||||
socket_path = os.environ['QMP_SOCKET']
|
||||
else:
|
||||
usage_error("no QMP socket path or address given");
|
||||
@@ -61,4 +63,4 @@ else:
|
||||
srv = QEMUMonitorProtocol(socket_path)
|
||||
srv.connect()
|
||||
|
||||
print srv.command('qom-set', path=path, property=prop, value=value)
|
||||
print(srv.command('qom-set', path=path, property=prop, value=value))
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
# the COPYING file in the top-level directory.
|
||||
##
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
import sys
|
||||
import os
|
||||
from qmp import QEMUMonitorProtocol
|
||||
from .qmp import QEMUMonitorProtocol
|
||||
|
||||
cmd, args = sys.argv[0], sys.argv[1:]
|
||||
socket_path = None
|
||||
@@ -35,7 +37,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||
|
||||
if len(args) > 0:
|
||||
if args[0] == "-h":
|
||||
print usage()
|
||||
print(usage())
|
||||
exit(0);
|
||||
elif args[0] == "-s":
|
||||
try:
|
||||
@@ -45,7 +47,7 @@ if len(args) > 0:
|
||||
args = args[2:]
|
||||
|
||||
if not socket_path:
|
||||
if os.environ.has_key('QMP_SOCKET'):
|
||||
if 'QMP_SOCKET' in os.environ:
|
||||
socket_path = os.environ['QMP_SOCKET']
|
||||
else:
|
||||
usage_error("no QMP socket path or address given");
|
||||
@@ -54,15 +56,15 @@ srv = QEMUMonitorProtocol(socket_path)
|
||||
srv.connect()
|
||||
|
||||
def list_node(path):
|
||||
print '%s' % path
|
||||
print('%s' % path)
|
||||
items = srv.command('qom-list', path=path)
|
||||
for item in items:
|
||||
if not item['type'].startswith('child<'):
|
||||
try:
|
||||
print ' %s: %s (%s)' % (item['name'], srv.command('qom-get', path=path, property=item['name']), item['type'])
|
||||
print(' %s: %s (%s)' % (item['name'], srv.command('qom-get', path=path, property=item['name']), item['type']))
|
||||
except:
|
||||
print ' %s: <EXCEPTION> (%s)' % (item['name'], item['type'])
|
||||
print ''
|
||||
print(' %s: <EXCEPTION> (%s)' % (item['name'], item['type']))
|
||||
print('')
|
||||
for item in items:
|
||||
if item['type'].startswith('child<'):
|
||||
list_node((path if (path != '/') else '') + '/' + item['name'])
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user