mirror of https://github.com/proxmox/mirror_qemu
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 -----BEGIN PGP SIGNATURE----- iQIcBAABCAAGBQJbHrRGAAoJECgHk2+YTcWmeV8P/ReYBQvv4QxFrGgFJs0unWR3 OLU/zZ3Uaf1U8Q/oJ/pLSYK+XFWJYC9utXApTpBr4Xaxd1eavHl/EpjS/iHaL8VB HguuvA2SdlU9+5ZJMk8IdG1Hft/cYLiLNCMJRQzrAL/CL/ToZOQyOPU0NNmyk0S5 J3cug4VCDJMs+unKPHL/ThxXoWS1sRq7DZyYeaFBqOuDBLf7ZXSGOWPTC4KKwGbl N7sXxhDUbXFnY6HYpdShB8gACeI4P0WN0UCtGkvMwjF17DbHMohgoaXkzUks4wCI gJF7m0tFY9rR2w/RPiHeZmPcuWsxFxKjLCE93qrxNSoq7DWQyS6UprIf1CaW6rgz rPJAbxjHedKhW3M4gW9utpqYlSweTg7kQP1jLStZATvCnRgjQ5BtDcBJFrXa0zdb 6+py9MlvE0ysiXPl6vmbcn8VzDq+TnmyXMj2zrpcXMLJphnUcJlD1EgbXMTqXRY5 HUN61ZWyc6nj3go52QaC1hupcCSf4macgoXWh8BORuHQZcL5xom4rOJL4MwhQIu/ 5crYp/Xa9SA1FU7c0we8Np53feSU+5PGY5VyHJJyRoVSEriJnvvN9kCBpziln+Y/ v0CIFt7ohVB1OzsdNvFLSsRrlPd1RReiGOE9ixgcb37mIKBPWc2u73Mws37lxxiC BO64VpDUXdwpyIrHXxTU =d1wy -----END PGP SIGNATURE----- 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>master
commit
5eca450b2e
1
Makefile
1
Makefile
|
@ -567,7 +567,6 @@ $(SRC_PATH)/scripts/qapi/types.py \
|
||||||
$(SRC_PATH)/scripts/qapi/visit.py \
|
$(SRC_PATH)/scripts/qapi/visit.py \
|
||||||
$(SRC_PATH)/scripts/qapi/common.py \
|
$(SRC_PATH)/scripts/qapi/common.py \
|
||||||
$(SRC_PATH)/scripts/qapi/doc.py \
|
$(SRC_PATH)/scripts/qapi/doc.py \
|
||||||
$(SRC_PATH)/scripts/ordereddict.py \
|
|
||||||
$(SRC_PATH)/scripts/qapi-gen.py
|
$(SRC_PATH)/scripts/qapi-gen.py
|
||||||
|
|
||||||
qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
|
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
|
# Note that if the Python conditional here evaluates True we will exit
|
||||||
# with status 1 which is a shell 'false' value.
|
# with status 1 which is a shell 'false' value.
|
||||||
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6))'; then
|
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
|
||||||
error_exit "Cannot use '$python', Python 2 >= 2.6 or Python 3 is required." \
|
error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \
|
||||||
"Use --python=/path/to/python to specify a supported Python."
|
"Use --python=/path/to/python to specify a supported Python."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid>
|
# Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid>
|
||||||
#
|
#
|
||||||
# Author: Harsh Prateek Bora
|
# Author: Harsh Prateek Bora
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import simpletrace
|
import simpletrace
|
||||||
|
|
||||||
|
@ -79,135 +80,135 @@ symbol_9p = {
|
||||||
|
|
||||||
class VirtFSRequestTracker(simpletrace.Analyzer):
|
class VirtFSRequestTracker(simpletrace.Analyzer):
|
||||||
def begin(self):
|
def begin(self):
|
||||||
print "Pretty printing 9p simpletrace log ..."
|
print("Pretty printing 9p simpletrace log ...")
|
||||||
|
|
||||||
def v9fs_rerror(self, tag, id, err):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
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):
|
def v9fs_readlink_return(self, tag, id, target):
|
||||||
print "RREADLINK (tag =", tag, ", target =", target, ")"
|
print("RREADLINK (tag =", tag, ", target =", target, ")")
|
||||||
|
|
||||||
simpletrace.run(VirtFSRequestTracker())
|
simpletrace.run(VirtFSRequestTracker())
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# Author: Alex Bennée <alex.bennee@linaro.org>
|
# Author: Alex Bennée <alex.bennee@linaro.org>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import simpletrace
|
import simpletrace
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -77,7 +78,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# Now dump the individual lock stats
|
# Now dump the individual lock stats
|
||||||
for key, val in sorted(analyser.mutex_records.iteritems(),
|
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" %
|
print ("Lock: %#x locks: %d, locked: %d, unlocked: %d" %
|
||||||
(key, val["locks"], val["locked"], val["unlocked"]))
|
(key, val["locks"], val["locked"], val["unlocked"]))
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# 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/>.
|
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
@ -162,7 +163,7 @@ class RamSection(object):
|
||||||
len = self.file.read64()
|
len = self.file.read64()
|
||||||
self.sizeinfo[self.name] = '0x%016x' % len
|
self.sizeinfo[self.name] = '0x%016x' % len
|
||||||
if self.write_memory:
|
if self.write_memory:
|
||||||
print self.name
|
print(self.name)
|
||||||
mkdir_p('./' + os.path.dirname(self.name))
|
mkdir_p('./' + os.path.dirname(self.name))
|
||||||
f = open('./' + self.name, "wb")
|
f = open('./' + self.name, "wb")
|
||||||
f.truncate(0)
|
f.truncate(0)
|
||||||
|
@ -588,7 +589,7 @@ if args.extract:
|
||||||
dump = MigrationDump(args.file)
|
dump = MigrationDump(args.file)
|
||||||
|
|
||||||
dump.read(desc_only = True)
|
dump.read(desc_only = True)
|
||||||
print "desc.json"
|
print("desc.json")
|
||||||
f = open("desc.json", "wb")
|
f = open("desc.json", "wb")
|
||||||
f.truncate()
|
f.truncate()
|
||||||
f.write(jsonenc.encode(dump.vmsd_desc))
|
f.write(jsonenc.encode(dump.vmsd_desc))
|
||||||
|
@ -596,7 +597,7 @@ if args.extract:
|
||||||
|
|
||||||
dump.read(write_memory = True)
|
dump.read(write_memory = True)
|
||||||
dict = dump.getDict()
|
dict = dump.getDict()
|
||||||
print "state.json"
|
print("state.json")
|
||||||
f = open("state.json", "wb")
|
f = open("state.json", "wb")
|
||||||
f.truncate()
|
f.truncate()
|
||||||
f.write(jsonenc.encode(dict))
|
f.write(jsonenc.encode(dict))
|
||||||
|
@ -605,10 +606,10 @@ elif args.dump == "state":
|
||||||
dump = MigrationDump(args.file)
|
dump = MigrationDump(args.file)
|
||||||
dump.read(dump_memory = args.memory)
|
dump.read(dump_memory = args.memory)
|
||||||
dict = dump.getDict()
|
dict = dump.getDict()
|
||||||
print jsonenc.encode(dict)
|
print(jsonenc.encode(dict))
|
||||||
elif args.dump == "desc":
|
elif args.dump == "desc":
|
||||||
dump = MigrationDump(args.file)
|
dump = MigrationDump(args.file)
|
||||||
dump.read(desc_only = True)
|
dump.read(desc_only = True)
|
||||||
print jsonenc.encode(dump.vmsd_desc)
|
print(jsonenc.encode(dump.vmsd_desc))
|
||||||
else:
|
else:
|
||||||
raise Exception("Please specify either -x, -d state or -d dump")
|
raise Exception("Please specify either -x, -d state or -d dump")
|
||||||
|
|
2406
scripts/argparse.py
2406
scripts/argparse.py
File diff suppressed because it is too large
Load Diff
|
@ -23,6 +23,7 @@
|
||||||
Run QEMU with all combinations of -machine and -device types,
|
Run QEMU with all combinations of -machine and -device types,
|
||||||
check for crashes and unexpected errors.
|
check for crashes and unexpected errors.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -554,7 +555,7 @@ def main():
|
||||||
tc[k] = v
|
tc[k] = v
|
||||||
|
|
||||||
if len(binariesToTest(args, tc)) == 0:
|
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)
|
parser.print_usage(sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ Authors:
|
||||||
This work is licensed under the terms of the GNU GPL, version 2 or later. See
|
This work is licensed under the terms of the GNU GPL, version 2 or later. See
|
||||||
the COPYING file in the top-level directory.
|
the COPYING file in the top-level directory.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
import struct
|
import struct
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
# consuming CPU cycles. No disk I/O is performed since the ring buffer holds a
|
# consuming CPU cycles. No disk I/O is performed since the ring buffer holds a
|
||||||
# fixed-size in-memory trace.
|
# fixed-size in-memory trace.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -77,8 +78,8 @@ def tail_trace():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print 'Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0]
|
print('Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0])
|
||||||
print 'Control the KVM flight recorder tracing.'
|
print('Control the KVM flight recorder tracing.')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -87,15 +88,15 @@ def main():
|
||||||
|
|
||||||
cmd = sys.argv[1]
|
cmd = sys.argv[1]
|
||||||
if cmd == '--version':
|
if cmd == '--version':
|
||||||
print 'kvm_flightrecorder version 1.0'
|
print('kvm_flightrecorder version 1.0')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if not os.path.isdir(tracing_dir):
|
if not os.path.isdir(tracing_dir):
|
||||||
print 'Unable to tracing debugfs directory, try:'
|
print('Unable to tracing debugfs directory, try:')
|
||||||
print 'mount -t debugfs none /sys/kernel/debug'
|
print('mount -t debugfs none /sys/kernel/debug')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if not os.access(tracing_dir, os.W_OK):
|
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)
|
sys.exit(1)
|
||||||
|
|
||||||
if cmd == 'start':
|
if cmd == 'start':
|
||||||
|
@ -105,16 +106,16 @@ def main():
|
||||||
try:
|
try:
|
||||||
buffer_size_kb = int(sys.argv[2])
|
buffer_size_kb = int(sys.argv[2])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print 'Invalid per-cpu trace buffer size in KB'
|
print('Invalid per-cpu trace buffer size in KB')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
write_file(trace_path('buffer_size_kb'), str(buffer_size_kb))
|
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()
|
start_tracing()
|
||||||
print 'KVM flight recorder enabled'
|
print('KVM flight recorder enabled')
|
||||||
elif cmd == 'stop':
|
elif cmd == 'stop':
|
||||||
stop_tracing()
|
stop_tracing()
|
||||||
print 'KVM flight recorder disabled'
|
print('KVM flight recorder disabled')
|
||||||
elif cmd == 'dump':
|
elif cmd == 'dump':
|
||||||
dump_trace()
|
dump_trace()
|
||||||
elif cmd == 'tail':
|
elif cmd == 'tail':
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# This work is licensed under the terms of the GNU GPL, version 2. See
|
# This work is licensed under the terms of the GNU GPL, version 2. See
|
||||||
# the COPYING file in the top-level directory.
|
# the COPYING file in the top-level directory.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
MSR_IA32_VMX_BASIC = 0x480
|
MSR_IA32_VMX_BASIC = 0x480
|
||||||
MSR_IA32_VMX_PINBASED_CTLS = 0x481
|
MSR_IA32_VMX_PINBASED_CTLS = 0x481
|
||||||
MSR_IA32_VMX_PROCBASED_CTLS = 0x482
|
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 os
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
try:
|
from collections import OrderedDict
|
||||||
from collections import OrderedDict
|
|
||||||
except:
|
|
||||||
from ordereddict import OrderedDict
|
|
||||||
|
|
||||||
builtin_types = {
|
builtin_types = {
|
||||||
'null': 'QTYPE_QNULL',
|
'null': 'QTYPE_QNULL',
|
||||||
|
|
|
@ -36,10 +36,12 @@
|
||||||
# See also: https://wiki.qemu.org/Features/QAPI/GuestAgent
|
# See also: https://wiki.qemu.org/Features/QAPI/GuestAgent
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
import base64
|
import base64
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import qmp
|
from . import qmp
|
||||||
|
|
||||||
|
|
||||||
class QemuGuestAgent(qmp.QEMUMonitorProtocol):
|
class QemuGuestAgent(qmp.QEMUMonitorProtocol):
|
||||||
|
@ -135,7 +137,7 @@ class QemuGuestAgentClient:
|
||||||
|
|
||||||
def fsfreeze(self, cmd):
|
def fsfreeze(self, cmd):
|
||||||
if cmd not in ['status', 'freeze', 'thaw']:
|
if cmd not in ['status', 'freeze', 'thaw']:
|
||||||
raise StandardError('Invalid command: ' + cmd)
|
raise Exception('Invalid command: ' + cmd)
|
||||||
|
|
||||||
return getattr(self.qga, 'fsfreeze' + '_' + cmd)()
|
return getattr(self.qga, 'fsfreeze' + '_' + cmd)()
|
||||||
|
|
||||||
|
@ -144,7 +146,7 @@ class QemuGuestAgentClient:
|
||||||
|
|
||||||
def suspend(self, mode):
|
def suspend(self, mode):
|
||||||
if mode not in ['disk', 'ram', 'hybrid']:
|
if mode not in ['disk', 'ram', 'hybrid']:
|
||||||
raise StandardError('Invalid mode: ' + mode)
|
raise Exception('Invalid mode: ' + mode)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
getattr(self.qga, 'suspend' + '_' + mode)()
|
getattr(self.qga, 'suspend' + '_' + mode)()
|
||||||
|
@ -155,7 +157,7 @@ class QemuGuestAgentClient:
|
||||||
|
|
||||||
def shutdown(self, mode='powerdown'):
|
def shutdown(self, mode='powerdown'):
|
||||||
if mode not in ['powerdown', 'halt', 'reboot']:
|
if mode not in ['powerdown', 'halt', 'reboot']:
|
||||||
raise StandardError('Invalid mode: ' + mode)
|
raise Exception('Invalid mode: ' + mode)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.qga.shutdown(mode=mode)
|
self.qga.shutdown(mode=mode)
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
# This work is licensed under the terms of the GNU GPLv2 or later.
|
# This work is licensed under the terms of the GNU GPLv2 or later.
|
||||||
# See the COPYING file in the top-level directory.
|
# See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
import sys, os
|
import sys, os
|
||||||
from qmp import QEMUMonitorProtocol
|
from .qmp import QEMUMonitorProtocol
|
||||||
|
|
||||||
def print_response(rsp, prefix=[]):
|
def print_response(rsp, prefix=[]):
|
||||||
if type(rsp) == list:
|
if type(rsp) == list:
|
||||||
|
@ -26,15 +28,15 @@ def print_response(rsp, prefix=[]):
|
||||||
print_response(rsp[key], prefix + [key])
|
print_response(rsp[key], prefix + [key])
|
||||||
else:
|
else:
|
||||||
if len(prefix):
|
if len(prefix):
|
||||||
print '%s: %s' % ('.'.join(prefix), rsp)
|
print('%s: %s' % ('.'.join(prefix), rsp))
|
||||||
else:
|
else:
|
||||||
print '%s' % (rsp)
|
print('%s' % (rsp))
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
path = None
|
path = None
|
||||||
|
|
||||||
# Use QMP_PATH if it's set
|
# 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']
|
path = os.environ['QMP_PATH']
|
||||||
|
|
||||||
while len(args):
|
while len(args):
|
||||||
|
@ -53,21 +55,21 @@ def main(args):
|
||||||
elif arg in ['help']:
|
elif arg in ['help']:
|
||||||
os.execlp('man', 'man', 'qmp')
|
os.execlp('man', 'man', 'qmp')
|
||||||
else:
|
else:
|
||||||
print 'Unknown argument "%s"' % arg
|
print('Unknown argument "%s"' % arg)
|
||||||
|
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
if not path:
|
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
|
return 1
|
||||||
|
|
||||||
if len(args):
|
if len(args):
|
||||||
command, args = args[0], args[1:]
|
command, args = args[0], args[1:]
|
||||||
else:
|
else:
|
||||||
print 'No command found'
|
print('No command found')
|
||||||
print 'Usage: "qmp [--path=qmp-monitor-address] qmp-cmd arguments"'
|
print('Usage: "qmp [--path=qmp-monitor-address] qmp-cmd arguments"')
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if command in ['help']:
|
if command in ['help']:
|
||||||
|
@ -78,7 +80,7 @@ def main(args):
|
||||||
|
|
||||||
def do_command(srv, cmd, **kwds):
|
def do_command(srv, cmd, **kwds):
|
||||||
rsp = srv.cmd(cmd, kwds)
|
rsp = srv.cmd(cmd, kwds)
|
||||||
if rsp.has_key('error'):
|
if 'error' in rsp:
|
||||||
raise Exception(rsp['error']['desc'])
|
raise Exception(rsp['error']['desc'])
|
||||||
return rsp['return']
|
return rsp['return']
|
||||||
|
|
||||||
|
@ -93,7 +95,7 @@ def main(args):
|
||||||
os.execvp(fullcmd, [fullcmd] + args)
|
os.execvp(fullcmd, [fullcmd] + args)
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
if exc.errno == 2:
|
if exc.errno == 2:
|
||||||
print 'Command "%s" not found.' % (fullcmd)
|
print('Command "%s" not found.' % (fullcmd))
|
||||||
return 1
|
return 1
|
||||||
raise
|
raise
|
||||||
return 0
|
return 0
|
||||||
|
@ -104,7 +106,7 @@ def main(args):
|
||||||
arguments = {}
|
arguments = {}
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if not arg.startswith('--'):
|
if not arg.startswith('--'):
|
||||||
print 'Unknown argument "%s"' % arg
|
print('Unknown argument "%s"' % arg)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
arg = arg[2:]
|
arg = arg[2:]
|
||||||
|
|
|
@ -65,7 +65,9 @@
|
||||||
# which will echo back the properly formatted JSON-compliant QMP that is being
|
# which will echo back the properly formatted JSON-compliant QMP that is being
|
||||||
# sent to QEMU, which is useful for debugging and documentation generation.
|
# 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 json
|
||||||
import ast
|
import ast
|
||||||
import readline
|
import readline
|
||||||
|
@ -132,7 +134,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
|
|
||||||
def _fill_completion(self):
|
def _fill_completion(self):
|
||||||
cmds = self.cmd('query-commands')
|
cmds = self.cmd('query-commands')
|
||||||
if cmds.has_key('error'):
|
if 'error' in cmds:
|
||||||
return
|
return
|
||||||
for cmd in cmds['return']:
|
for cmd in cmds['return']:
|
||||||
self._completer.append(cmd['name'])
|
self._completer.append(cmd['name'])
|
||||||
|
@ -153,14 +155,14 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
# File not found. No problem.
|
# File not found. No problem.
|
||||||
pass
|
pass
|
||||||
else:
|
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)
|
atexit.register(self.__save_history)
|
||||||
|
|
||||||
def __save_history(self):
|
def __save_history(self):
|
||||||
try:
|
try:
|
||||||
readline.write_history_file(self._histfile)
|
readline.write_history_file(self._histfile)
|
||||||
except Exception as e:
|
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):
|
def __parse_value(self, val):
|
||||||
try:
|
try:
|
||||||
|
@ -258,15 +260,15 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
if self._pretty:
|
if self._pretty:
|
||||||
indent = 4
|
indent = 4
|
||||||
jsobj = json.dumps(qmp, indent=indent)
|
jsobj = json.dumps(qmp, indent=indent)
|
||||||
print str(jsobj)
|
print(str(jsobj))
|
||||||
|
|
||||||
def _execute_cmd(self, cmdline):
|
def _execute_cmd(self, cmdline):
|
||||||
try:
|
try:
|
||||||
qmpcmd = self.__build_cmd(cmdline)
|
qmpcmd = self.__build_cmd(cmdline)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print 'Error while parsing command line: %s' % e
|
print('Error while parsing command line: %s' % e)
|
||||||
print 'command format: <command-name> ',
|
print('command format: <command-name> ', end=' ')
|
||||||
print '[arg-name1=arg1] ... [arg-nameN=argN]'
|
print('[arg-name1=arg1] ... [arg-nameN=argN]')
|
||||||
return True
|
return True
|
||||||
# For transaction mode, we may have just cached the action:
|
# For transaction mode, we may have just cached the action:
|
||||||
if qmpcmd is None:
|
if qmpcmd is None:
|
||||||
|
@ -275,7 +277,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
self._print(qmpcmd)
|
self._print(qmpcmd)
|
||||||
resp = self.cmd_obj(qmpcmd)
|
resp = self.cmd_obj(qmpcmd)
|
||||||
if resp is None:
|
if resp is None:
|
||||||
print 'Disconnected'
|
print('Disconnected')
|
||||||
return False
|
return False
|
||||||
self._print(resp)
|
self._print(resp)
|
||||||
return True
|
return True
|
||||||
|
@ -285,12 +287,12 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
self.__completer_setup()
|
self.__completer_setup()
|
||||||
|
|
||||||
def show_banner(self, msg='Welcome to the QMP low-level shell!'):
|
def show_banner(self, msg='Welcome to the QMP low-level shell!'):
|
||||||
print msg
|
print(msg)
|
||||||
if not self._greeting:
|
if not self._greeting:
|
||||||
print 'Connected'
|
print('Connected')
|
||||||
return
|
return
|
||||||
version = self._greeting['QMP']['version']['qemu']
|
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):
|
def get_prompt(self):
|
||||||
if self._transmode:
|
if self._transmode:
|
||||||
|
@ -306,11 +308,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
try:
|
try:
|
||||||
cmdline = raw_input(prompt)
|
cmdline = raw_input(prompt)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
print
|
print()
|
||||||
return False
|
return False
|
||||||
if cmdline == '':
|
if cmdline == '':
|
||||||
for ev in self.get_events():
|
for ev in self.get_events():
|
||||||
print ev
|
print(ev)
|
||||||
self.clear_events()
|
self.clear_events()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -366,24 +368,24 @@ class HMPShell(QMPShell):
|
||||||
try:
|
try:
|
||||||
idx = int(cmdline.split()[1])
|
idx = int(cmdline.split()[1])
|
||||||
if not 'return' in self.__cmd_passthrough('info version', idx):
|
if not 'return' in self.__cmd_passthrough('info version', idx):
|
||||||
print 'bad CPU index'
|
print('bad CPU index')
|
||||||
return True
|
return True
|
||||||
self.__cpu_index = idx
|
self.__cpu_index = idx
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print 'cpu command takes an integer argument'
|
print('cpu command takes an integer argument')
|
||||||
return True
|
return True
|
||||||
resp = self.__cmd_passthrough(cmdline, self.__cpu_index)
|
resp = self.__cmd_passthrough(cmdline, self.__cpu_index)
|
||||||
if resp is None:
|
if resp is None:
|
||||||
print 'Disconnected'
|
print('Disconnected')
|
||||||
return False
|
return False
|
||||||
assert 'return' in resp or 'error' in resp
|
assert 'return' in resp or 'error' in resp
|
||||||
if 'return' in resp:
|
if 'return' in resp:
|
||||||
# Success
|
# Success
|
||||||
if len(resp['return']) > 0:
|
if len(resp['return']) > 0:
|
||||||
print resp['return'],
|
print(resp['return'], end=' ')
|
||||||
else:
|
else:
|
||||||
# Error
|
# Error
|
||||||
print '%s: %s' % (resp['error']['class'], resp['error']['desc'])
|
print('%s: %s' % (resp['error']['class'], resp['error']['desc']))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def show_banner(self):
|
def show_banner(self):
|
||||||
|
|
|
@ -11,11 +11,12 @@
|
||||||
# the COPYING file in the top-level directory.
|
# the COPYING file in the top-level directory.
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
import fuse, stat
|
import fuse, stat
|
||||||
from fuse import Fuse
|
from fuse import Fuse
|
||||||
import os, posix
|
import os, posix
|
||||||
from errno import *
|
from errno import *
|
||||||
from qmp import QEMUMonitorProtocol
|
from .qmp import QEMUMonitorProtocol
|
||||||
|
|
||||||
fuse.fuse_python_api = (0, 2)
|
fuse.fuse_python_api = (0, 2)
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ class QOMFS(Fuse):
|
||||||
self.ino_count = 1
|
self.ino_count = 1
|
||||||
|
|
||||||
def get_ino(self, path):
|
def get_ino(self, path):
|
||||||
if self.ino_map.has_key(path):
|
if path in self.ino_map:
|
||||||
return self.ino_map[path]
|
return self.ino_map[path]
|
||||||
self.ino_map[path] = self.ino_count
|
self.ino_map[path] = self.ino_count
|
||||||
self.ino_count += 1
|
self.ino_count += 1
|
||||||
|
@ -89,7 +90,7 @@ class QOMFS(Fuse):
|
||||||
|
|
||||||
def getattr(self, path):
|
def getattr(self, path):
|
||||||
if self.is_link(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),
|
self.get_ino(path),
|
||||||
0,
|
0,
|
||||||
2,
|
2,
|
||||||
|
@ -100,7 +101,7 @@ class QOMFS(Fuse):
|
||||||
0,
|
0,
|
||||||
0))
|
0))
|
||||||
elif self.is_object(path):
|
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),
|
self.get_ino(path),
|
||||||
0,
|
0,
|
||||||
2,
|
2,
|
||||||
|
@ -111,7 +112,7 @@ class QOMFS(Fuse):
|
||||||
0,
|
0,
|
||||||
0))
|
0))
|
||||||
elif self.is_property(path):
|
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),
|
self.get_ino(path),
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
# the COPYING file in the top-level directory.
|
# the COPYING file in the top-level directory.
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from qmp import QEMUMonitorProtocol
|
from .qmp import QEMUMonitorProtocol
|
||||||
|
|
||||||
cmd, args = sys.argv[0], sys.argv[1:]
|
cmd, args = sys.argv[0], sys.argv[1:]
|
||||||
socket_path = None
|
socket_path = None
|
||||||
|
@ -33,7 +35,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||||
|
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
if args[0] == "-h":
|
if args[0] == "-h":
|
||||||
print usage()
|
print(usage())
|
||||||
exit(0);
|
exit(0);
|
||||||
elif args[0] == "-s":
|
elif args[0] == "-s":
|
||||||
try:
|
try:
|
||||||
|
@ -43,7 +45,7 @@ if len(args) > 0:
|
||||||
args = args[2:]
|
args = args[2:]
|
||||||
|
|
||||||
if not socket_path:
|
if not socket_path:
|
||||||
if os.environ.has_key('QMP_SOCKET'):
|
if 'QMP_SOCKET' in os.environ:
|
||||||
socket_path = os.environ['QMP_SOCKET']
|
socket_path = os.environ['QMP_SOCKET']
|
||||||
else:
|
else:
|
||||||
usage_error("no QMP socket path or address given");
|
usage_error("no QMP socket path or address given");
|
||||||
|
@ -62,6 +64,6 @@ srv.connect()
|
||||||
rsp = srv.command('qom-get', path=path, property=prop)
|
rsp = srv.command('qom-get', path=path, property=prop)
|
||||||
if type(rsp) == dict:
|
if type(rsp) == dict:
|
||||||
for i in rsp.keys():
|
for i in rsp.keys():
|
||||||
print '%s: %s' % (i, rsp[i])
|
print('%s: %s' % (i, rsp[i]))
|
||||||
else:
|
else:
|
||||||
print rsp
|
print(rsp)
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
# the COPYING file in the top-level directory.
|
# the COPYING file in the top-level directory.
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from qmp import QEMUMonitorProtocol
|
from .qmp import QEMUMonitorProtocol
|
||||||
|
|
||||||
cmd, args = sys.argv[0], sys.argv[1:]
|
cmd, args = sys.argv[0], sys.argv[1:]
|
||||||
socket_path = None
|
socket_path = None
|
||||||
|
@ -33,7 +35,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||||
|
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
if args[0] == "-h":
|
if args[0] == "-h":
|
||||||
print usage()
|
print(usage())
|
||||||
exit(0);
|
exit(0);
|
||||||
elif args[0] == "-s":
|
elif args[0] == "-s":
|
||||||
try:
|
try:
|
||||||
|
@ -43,7 +45,7 @@ if len(args) > 0:
|
||||||
args = args[2:]
|
args = args[2:]
|
||||||
|
|
||||||
if not socket_path:
|
if not socket_path:
|
||||||
if os.environ.has_key('QMP_SOCKET'):
|
if 'QMP_SOCKET' in os.environ:
|
||||||
socket_path = os.environ['QMP_SOCKET']
|
socket_path = os.environ['QMP_SOCKET']
|
||||||
else:
|
else:
|
||||||
usage_error("no QMP socket path or address given");
|
usage_error("no QMP socket path or address given");
|
||||||
|
@ -52,13 +54,13 @@ srv = QEMUMonitorProtocol(socket_path)
|
||||||
srv.connect()
|
srv.connect()
|
||||||
|
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
print '/'
|
print('/')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
for item in srv.command('qom-list', path=args[0]):
|
for item in srv.command('qom-list', path=args[0]):
|
||||||
if item['type'].startswith('child<'):
|
if item['type'].startswith('child<'):
|
||||||
print '%s/' % item['name']
|
print('%s/' % item['name'])
|
||||||
elif item['type'].startswith('link<'):
|
elif item['type'].startswith('link<'):
|
||||||
print '@%s/' % item['name']
|
print('@%s/' % item['name'])
|
||||||
else:
|
else:
|
||||||
print '%s' % item['name']
|
print('%s' % item['name'])
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
# the COPYING file in the top-level directory.
|
# the COPYING file in the top-level directory.
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from qmp import QEMUMonitorProtocol
|
from .qmp import QEMUMonitorProtocol
|
||||||
|
|
||||||
cmd, args = sys.argv[0], sys.argv[1:]
|
cmd, args = sys.argv[0], sys.argv[1:]
|
||||||
socket_path = None
|
socket_path = None
|
||||||
|
@ -34,7 +36,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||||
|
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
if args[0] == "-h":
|
if args[0] == "-h":
|
||||||
print usage()
|
print(usage())
|
||||||
exit(0);
|
exit(0);
|
||||||
elif args[0] == "-s":
|
elif args[0] == "-s":
|
||||||
try:
|
try:
|
||||||
|
@ -44,7 +46,7 @@ if len(args) > 0:
|
||||||
args = args[2:]
|
args = args[2:]
|
||||||
|
|
||||||
if not socket_path:
|
if not socket_path:
|
||||||
if os.environ.has_key('QMP_SOCKET'):
|
if 'QMP_SOCKET' in os.environ:
|
||||||
socket_path = os.environ['QMP_SOCKET']
|
socket_path = os.environ['QMP_SOCKET']
|
||||||
else:
|
else:
|
||||||
usage_error("no QMP socket path or address given");
|
usage_error("no QMP socket path or address given");
|
||||||
|
@ -61,4 +63,4 @@ else:
|
||||||
srv = QEMUMonitorProtocol(socket_path)
|
srv = QEMUMonitorProtocol(socket_path)
|
||||||
srv.connect()
|
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.
|
# the COPYING file in the top-level directory.
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from qmp import QEMUMonitorProtocol
|
from .qmp import QEMUMonitorProtocol
|
||||||
|
|
||||||
cmd, args = sys.argv[0], sys.argv[1:]
|
cmd, args = sys.argv[0], sys.argv[1:]
|
||||||
socket_path = None
|
socket_path = None
|
||||||
|
@ -35,7 +37,7 @@ def usage_error(error_msg = "unspecified error"):
|
||||||
|
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
if args[0] == "-h":
|
if args[0] == "-h":
|
||||||
print usage()
|
print(usage())
|
||||||
exit(0);
|
exit(0);
|
||||||
elif args[0] == "-s":
|
elif args[0] == "-s":
|
||||||
try:
|
try:
|
||||||
|
@ -45,7 +47,7 @@ if len(args) > 0:
|
||||||
args = args[2:]
|
args = args[2:]
|
||||||
|
|
||||||
if not socket_path:
|
if not socket_path:
|
||||||
if os.environ.has_key('QMP_SOCKET'):
|
if 'QMP_SOCKET' in os.environ:
|
||||||
socket_path = os.environ['QMP_SOCKET']
|
socket_path = os.environ['QMP_SOCKET']
|
||||||
else:
|
else:
|
||||||
usage_error("no QMP socket path or address given");
|
usage_error("no QMP socket path or address given");
|
||||||
|
@ -54,15 +56,15 @@ srv = QEMUMonitorProtocol(socket_path)
|
||||||
srv.connect()
|
srv.connect()
|
||||||
|
|
||||||
def list_node(path):
|
def list_node(path):
|
||||||
print '%s' % path
|
print('%s' % path)
|
||||||
items = srv.command('qom-list', path=path)
|
items = srv.command('qom-list', path=path)
|
||||||
for item in items:
|
for item in items:
|
||||||
if not item['type'].startswith('child<'):
|
if not item['type'].startswith('child<'):
|
||||||
try:
|
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:
|
except:
|
||||||
print ' %s: <EXCEPTION> (%s)' % (item['name'], item['type'])
|
print(' %s: <EXCEPTION> (%s)' % (item['name'], item['type']))
|
||||||
print ''
|
print('')
|
||||||
for item in items:
|
for item in items:
|
||||||
if item['type'].startswith('child<'):
|
if item['type'].startswith('child<'):
|
||||||
list_node((path if (path != '/') else '') + '/' + item['name'])
|
list_node((path if (path != '/') else '') + '/' + item['name'])
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# 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/>.
|
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import argparse
|
import argparse
|
||||||
import struct
|
import struct
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
@ -89,9 +90,9 @@ def call_decode(table, index, dumpfile):
|
||||||
"Search decode table for next step"
|
"Search decode table for next step"
|
||||||
decoder = next((d for d in table if d.eid == index), None)
|
decoder = next((d for d in table if d.eid == index), None)
|
||||||
if not decoder:
|
if not decoder:
|
||||||
print "Could not decode index: %d" % (index)
|
print("Could not decode index: %d" % (index))
|
||||||
print "Entry is: %s" % (decoder)
|
print("Entry is: %s" % (decoder))
|
||||||
print "Decode Table is:\n%s" % (table)
|
print("Decode Table is:\n%s" % (table))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return decoder.fn(decoder.eid, decoder.name, dumpfile)
|
return decoder.fn(decoder.eid, decoder.name, dumpfile)
|
||||||
|
@ -103,23 +104,23 @@ def print_event(eid, name, string=None, event_count=None):
|
||||||
event_count = replay_state.event_count
|
event_count = replay_state.event_count
|
||||||
|
|
||||||
if string:
|
if string:
|
||||||
print "%d:%s(%d) %s" % (event_count, name, eid, string)
|
print("%d:%s(%d) %s" % (event_count, name, eid, string))
|
||||||
else:
|
else:
|
||||||
print "%d:%s(%d)" % (event_count, name, eid)
|
print("%d:%s(%d)" % (event_count, name, eid))
|
||||||
|
|
||||||
|
|
||||||
# Decoders for each event type
|
# Decoders for each event type
|
||||||
|
|
||||||
def decode_unimp(eid, name, _unused_dumpfile):
|
def decode_unimp(eid, name, _unused_dumpfile):
|
||||||
"Unimplimented decoder, will trigger exit"
|
"Unimplimented decoder, will trigger exit"
|
||||||
print "%s not handled - will now stop" % (name)
|
print("%s not handled - will now stop" % (name))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Checkpoint decoder
|
# Checkpoint decoder
|
||||||
def swallow_async_qword(eid, name, dumpfile):
|
def swallow_async_qword(eid, name, dumpfile):
|
||||||
"Swallow a qword of data without looking at it"
|
"Swallow a qword of data without looking at it"
|
||||||
step_id = read_qword(dumpfile)
|
step_id = read_qword(dumpfile)
|
||||||
print " %s(%d) @ %d" % (name, eid, step_id)
|
print(" %s(%d) @ %d" % (name, eid, step_id))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async_qword),
|
async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async_qword),
|
||||||
|
@ -139,8 +140,8 @@ def decode_async(eid, name, dumpfile):
|
||||||
async_event_checkpoint = read_byte(dumpfile)
|
async_event_checkpoint = read_byte(dumpfile)
|
||||||
|
|
||||||
if async_event_checkpoint != replay_state.current_checkpoint:
|
if async_event_checkpoint != replay_state.current_checkpoint:
|
||||||
print " mismatch between checkpoint %d and async data %d" % (
|
print(" mismatch between checkpoint %d and async data %d" % (
|
||||||
replay_state.current_checkpoint, async_event_checkpoint)
|
replay_state.current_checkpoint, async_event_checkpoint))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return call_decode(async_decode_table, async_event_kind, dumpfile)
|
return call_decode(async_decode_table, async_event_kind, dumpfile)
|
||||||
|
@ -283,7 +284,7 @@ def decode_file(filename):
|
||||||
version = read_dword(dumpfile)
|
version = read_dword(dumpfile)
|
||||||
junk = read_qword(dumpfile)
|
junk = read_qword(dumpfile)
|
||||||
|
|
||||||
print "HEADER: version 0x%x" % (version)
|
print("HEADER: version 0x%x" % (version))
|
||||||
|
|
||||||
if version == 0xe02007:
|
if version == 0xe02007:
|
||||||
event_decode_table = v7_event_table
|
event_decode_table = v7_event_table
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
#
|
#
|
||||||
# Option ROM signing utility
|
# Option ROM signing utility
|
||||||
#
|
#
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#
|
#
|
||||||
# For help see docs/devel/tracing.txt
|
# For help see docs/devel/tracing.txt
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import struct
|
import struct
|
||||||
import re
|
import re
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -44,7 +45,7 @@ def get_record(edict, idtoname, rechdr, fobj):
|
||||||
rec = (name, rechdr[1], rechdr[3])
|
rec = (name, rechdr[1], rechdr[3])
|
||||||
try:
|
try:
|
||||||
event = edict[name]
|
event = edict[name]
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
import sys
|
import sys
|
||||||
sys.stderr.write('%s event is logged but is not declared ' \
|
sys.stderr.write('%s event is logged but is not declared ' \
|
||||||
'in the trace events file, try using ' \
|
'in the trace events file, try using ' \
|
||||||
|
@ -257,6 +258,6 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
fields.append('%s=0x%x' % (name, rec[i]))
|
fields.append('%s=0x%x' % (name, rec[i]))
|
||||||
i += 1
|
i += 1
|
||||||
print ' '.join(fields)
|
print(' '.join(fields))
|
||||||
|
|
||||||
run(Formatter())
|
run(Formatter())
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
@ -157,7 +158,7 @@ def check_fields(src_fields, dest_fields, desc, sec):
|
||||||
while True:
|
while True:
|
||||||
if advance_src:
|
if advance_src:
|
||||||
try:
|
try:
|
||||||
s_item = s_iter.next()
|
s_item = next(s_iter)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
if s_iter_list == []:
|
if s_iter_list == []:
|
||||||
break
|
break
|
||||||
|
@ -172,14 +173,14 @@ def check_fields(src_fields, dest_fields, desc, sec):
|
||||||
|
|
||||||
if advance_dest:
|
if advance_dest:
|
||||||
try:
|
try:
|
||||||
d_item = d_iter.next()
|
d_item = next(d_iter)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
if d_iter_list == []:
|
if d_iter_list == []:
|
||||||
# We were not in a substruct
|
# We were not in a substruct
|
||||||
print "Section \"" + sec + "\",",
|
print("Section \"" + sec + "\",", end=' ')
|
||||||
print "Description " + "\"" + desc + "\":",
|
print("Description " + "\"" + desc + "\":", end=' ')
|
||||||
print "expected field \"" + s_item["field"] + "\",",
|
print("expected field \"" + s_item["field"] + "\",", end=' ')
|
||||||
print "while dest has no further fields"
|
print("while dest has no further fields")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -197,10 +198,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
|
||||||
advance_dest = True
|
advance_dest = True
|
||||||
continue
|
continue
|
||||||
if unused_count < 0:
|
if unused_count < 0:
|
||||||
print "Section \"" + sec + "\",",
|
print("Section \"" + sec + "\",", end=' ')
|
||||||
print "Description \"" + desc + "\":",
|
print("Description \"" + desc + "\":", end=' ')
|
||||||
print "unused size mismatch near \"",
|
print("unused size mismatch near \"", end=' ')
|
||||||
print s_item["field"] + "\""
|
print(s_item["field"] + "\"")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
break
|
break
|
||||||
continue
|
continue
|
||||||
|
@ -211,10 +212,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
|
||||||
advance_src = True
|
advance_src = True
|
||||||
continue
|
continue
|
||||||
if unused_count < 0:
|
if unused_count < 0:
|
||||||
print "Section \"" + sec + "\",",
|
print("Section \"" + sec + "\",", end=' ')
|
||||||
print "Description \"" + desc + "\":",
|
print("Description \"" + desc + "\":", end=' ')
|
||||||
print "unused size mismatch near \"",
|
print("unused size mismatch near \"", end=' ')
|
||||||
print d_item["field"] + "\""
|
print(d_item["field"] + "\"")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
break
|
break
|
||||||
continue
|
continue
|
||||||
|
@ -262,10 +263,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
|
||||||
unused_count = s_item["size"] - d_item["size"]
|
unused_count = s_item["size"] - d_item["size"]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print "Section \"" + sec + "\",",
|
print("Section \"" + sec + "\",", end=' ')
|
||||||
print "Description \"" + desc + "\":",
|
print("Description \"" + desc + "\":", end=' ')
|
||||||
print "expected field \"" + s_item["field"] + "\",",
|
print("expected field \"" + s_item["field"] + "\",", end=' ')
|
||||||
print "got \"" + d_item["field"] + "\"; skipping rest"
|
print("got \"" + d_item["field"] + "\"; skipping rest")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -289,8 +290,8 @@ def check_subsections(src_sub, dest_sub, desc, sec):
|
||||||
check_descriptions(s_item, d_item, sec)
|
check_descriptions(s_item, d_item, sec)
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
print "Section \"" + sec + "\", Description \"" + desc + "\":",
|
print("Section \"" + sec + "\", Description \"" + desc + "\":", end=' ')
|
||||||
print "Subsection \"" + s_item["name"] + "\" not found"
|
print("Subsection \"" + s_item["name"] + "\" not found")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,8 +300,8 @@ def check_description_in_list(s_item, d_item, sec, desc):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not "Description" in d_item:
|
if not "Description" in d_item:
|
||||||
print "Section \"" + sec + "\", Description \"" + desc + "\",",
|
print("Section \"" + sec + "\", Description \"" + desc + "\",", end=' ')
|
||||||
print "Field \"" + s_item["field"] + "\": missing description"
|
print("Field \"" + s_item["field"] + "\": missing description")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -311,17 +312,17 @@ def check_descriptions(src_desc, dest_desc, sec):
|
||||||
check_version(src_desc, dest_desc, sec, src_desc["name"])
|
check_version(src_desc, dest_desc, sec, src_desc["name"])
|
||||||
|
|
||||||
if not check_fields_match(sec, src_desc["name"], dest_desc["name"]):
|
if not check_fields_match(sec, src_desc["name"], dest_desc["name"]):
|
||||||
print "Section \"" + sec + "\":",
|
print("Section \"" + sec + "\":", end=' ')
|
||||||
print "Description \"" + src_desc["name"] + "\"",
|
print("Description \"" + src_desc["name"] + "\"", end=' ')
|
||||||
print "missing, got \"" + dest_desc["name"] + "\" instead; skipping"
|
print("missing, got \"" + dest_desc["name"] + "\" instead; skipping")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
return
|
return
|
||||||
|
|
||||||
for f in src_desc:
|
for f in src_desc:
|
||||||
if not f in dest_desc:
|
if not f in dest_desc:
|
||||||
print "Section \"" + sec + "\"",
|
print("Section \"" + sec + "\"", end=' ')
|
||||||
print "Description \"" + src_desc["name"] + "\":",
|
print("Description \"" + src_desc["name"] + "\":", end=' ')
|
||||||
print "Entry \"" + f + "\" missing"
|
print("Entry \"" + f + "\" missing")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -334,39 +335,39 @@ def check_descriptions(src_desc, dest_desc, sec):
|
||||||
|
|
||||||
def check_version(s, d, sec, desc=None):
|
def check_version(s, d, sec, desc=None):
|
||||||
if s["version_id"] > d["version_id"]:
|
if s["version_id"] > d["version_id"]:
|
||||||
print "Section \"" + sec + "\"",
|
print("Section \"" + sec + "\"", end=' ')
|
||||||
if desc:
|
if desc:
|
||||||
print "Description \"" + desc + "\":",
|
print("Description \"" + desc + "\":", end=' ')
|
||||||
print "version error:", s["version_id"], ">", d["version_id"]
|
print("version error:", s["version_id"], ">", d["version_id"])
|
||||||
bump_taint()
|
bump_taint()
|
||||||
|
|
||||||
if not "minimum_version_id" in d:
|
if not "minimum_version_id" in d:
|
||||||
return
|
return
|
||||||
|
|
||||||
if s["version_id"] < d["minimum_version_id"]:
|
if s["version_id"] < d["minimum_version_id"]:
|
||||||
print "Section \"" + sec + "\"",
|
print("Section \"" + sec + "\"", end=' ')
|
||||||
if desc:
|
if desc:
|
||||||
print "Description \"" + desc + "\":",
|
print("Description \"" + desc + "\":", end=' ')
|
||||||
print "minimum version error:", s["version_id"], "<",
|
print("minimum version error:", s["version_id"], "<", end=' ')
|
||||||
print d["minimum_version_id"]
|
print(d["minimum_version_id"])
|
||||||
bump_taint()
|
bump_taint()
|
||||||
|
|
||||||
|
|
||||||
def check_size(s, d, sec, desc=None, field=None):
|
def check_size(s, d, sec, desc=None, field=None):
|
||||||
if s["size"] != d["size"]:
|
if s["size"] != d["size"]:
|
||||||
print "Section \"" + sec + "\"",
|
print("Section \"" + sec + "\"", end=' ')
|
||||||
if desc:
|
if desc:
|
||||||
print "Description \"" + desc + "\"",
|
print("Description \"" + desc + "\"", end=' ')
|
||||||
if field:
|
if field:
|
||||||
print "Field \"" + field + "\"",
|
print("Field \"" + field + "\"", end=' ')
|
||||||
print "size mismatch:", s["size"], ",", d["size"]
|
print("size mismatch:", s["size"], ",", d["size"])
|
||||||
bump_taint()
|
bump_taint()
|
||||||
|
|
||||||
|
|
||||||
def check_machine_type(s, d):
|
def check_machine_type(s, d):
|
||||||
if s["Name"] != d["Name"]:
|
if s["Name"] != d["Name"]:
|
||||||
print "Warning: checking incompatible machine types:",
|
print("Warning: checking incompatible machine types:", end=' ')
|
||||||
print "\"" + s["Name"] + "\", \"" + d["Name"] + "\""
|
print("\"" + s["Name"] + "\", \"" + d["Name"] + "\"")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -400,7 +401,7 @@ def main():
|
||||||
# doesn't exist in dest.
|
# doesn't exist in dest.
|
||||||
dest_sec = get_changed_sec_name(sec)
|
dest_sec = get_changed_sec_name(sec)
|
||||||
if not dest_sec in dest_data:
|
if not dest_sec in dest_data:
|
||||||
print "Section \"" + sec + "\" does not exist in dest"
|
print("Section \"" + sec + "\" does not exist in dest")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -415,8 +416,8 @@ def main():
|
||||||
|
|
||||||
for entry in s:
|
for entry in s:
|
||||||
if not entry in d:
|
if not entry in d:
|
||||||
print "Section \"" + sec + "\": Entry \"" + entry + "\"",
|
print("Section \"" + sec + "\": Entry \"" + entry + "\"", end=' ')
|
||||||
print "missing"
|
print("missing")
|
||||||
bump_taint()
|
bump_taint()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ $(SRC_PATH)/scripts/qapi/types.py \
|
||||||
$(SRC_PATH)/scripts/qapi/visit.py \
|
$(SRC_PATH)/scripts/qapi/visit.py \
|
||||||
$(SRC_PATH)/scripts/qapi/common.py \
|
$(SRC_PATH)/scripts/qapi/common.py \
|
||||||
$(SRC_PATH)/scripts/qapi/doc.py \
|
$(SRC_PATH)/scripts/qapi/doc.py \
|
||||||
$(SRC_PATH)/scripts/ordereddict.py \
|
|
||||||
$(SRC_PATH)/scripts/qapi-gen.py
|
$(SRC_PATH)/scripts/qapi-gen.py
|
||||||
|
|
||||||
# Get the list of all supported sysemu targets
|
# Get the list of all supported sysemu targets
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# or (at your option) any later version. See the COPYING file in
|
# or (at your option) any later version. See the COPYING file in
|
||||||
# the top-level directory.
|
# the top-level directory.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__),
|
sys.path.append(os.path.join(os.path.dirname(__file__),
|
||||||
|
@ -87,7 +88,7 @@ def _get_so_libs(executable):
|
||||||
so_lib = search.groups()[1]
|
so_lib = search.groups()[1]
|
||||||
libs.append("%s/%s" % (so_path, so_lib))
|
libs.append("%s/%s" % (so_path, so_lib))
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print "%s had no associated libraries (static build?)" % (executable)
|
print("%s had no associated libraries (static build?)" % (executable))
|
||||||
|
|
||||||
return libs
|
return libs
|
||||||
|
|
||||||
|
@ -161,7 +162,7 @@ class Docker(object):
|
||||||
continue
|
continue
|
||||||
if only_known and instance_uuid not in self._instances:
|
if only_known and instance_uuid not in self._instances:
|
||||||
continue
|
continue
|
||||||
print "Terminating", i
|
print("Terminating", i)
|
||||||
if active:
|
if active:
|
||||||
self._do(["kill", i])
|
self._do(["kill", i])
|
||||||
self._do(["rm", i])
|
self._do(["rm", i])
|
||||||
|
@ -288,7 +289,7 @@ class BuildCommand(SubCommand):
|
||||||
if "--no-cache" not in argv and \
|
if "--no-cache" not in argv and \
|
||||||
dkr.image_matches_dockerfile(tag, dockerfile):
|
dkr.image_matches_dockerfile(tag, dockerfile):
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
print "Image is up to date."
|
print("Image is up to date.")
|
||||||
else:
|
else:
|
||||||
# Create a docker context directory for the build
|
# Create a docker context directory for the build
|
||||||
docker_dir = tempfile.mkdtemp(prefix="docker_build")
|
docker_dir = tempfile.mkdtemp(prefix="docker_build")
|
||||||
|
@ -300,10 +301,10 @@ class BuildCommand(SubCommand):
|
||||||
rc = subprocess.call(os.path.realpath(docker_pre),
|
rc = subprocess.call(os.path.realpath(docker_pre),
|
||||||
cwd=docker_dir, stdout=stdout)
|
cwd=docker_dir, stdout=stdout)
|
||||||
if rc == 3:
|
if rc == 3:
|
||||||
print "Skip"
|
print("Skip")
|
||||||
return 0
|
return 0
|
||||||
elif rc != 0:
|
elif rc != 0:
|
||||||
print "%s exited with code %d" % (docker_pre, rc)
|
print("%s exited with code %d" % (docker_pre, rc))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# Copy any extra files into the Docker context. These can be
|
# Copy any extra files into the Docker context. These can be
|
||||||
|
@ -399,11 +400,11 @@ class ProbeCommand(SubCommand):
|
||||||
try:
|
try:
|
||||||
docker = Docker()
|
docker = Docker()
|
||||||
if docker._command[0] == "docker":
|
if docker._command[0] == "docker":
|
||||||
print "yes"
|
print("yes")
|
||||||
elif docker._command[0] == "sudo":
|
elif docker._command[0] == "sudo":
|
||||||
print "sudo"
|
print("sudo")
|
||||||
except Exception:
|
except Exception:
|
||||||
print "no"
|
print("no")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# or (at your option) any later version. See the COPYING file in
|
# or (at your option) any later version. See the COPYING file in
|
||||||
# the top-level directory.
|
# the top-level directory.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import yaml
|
import yaml
|
||||||
import itertools
|
import itertools
|
||||||
|
@ -34,14 +35,14 @@ def main():
|
||||||
sys.stderr.write("Usage: %s <travis-file>\n" % sys.argv[0])
|
sys.stderr.write("Usage: %s <travis-file>\n" % sys.argv[0])
|
||||||
return 1
|
return 1
|
||||||
conf = load_yaml(sys.argv[1])
|
conf = load_yaml(sys.argv[1])
|
||||||
print "\n".join((": ${%s}" % var for var in conf["env"]["global"]))
|
print("\n".join((": ${%s}" % var for var in conf["env"]["global"])))
|
||||||
for config in conf_iter(conf):
|
for config in conf_iter(conf):
|
||||||
print "("
|
print("(")
|
||||||
print "\n".join(config["env"])
|
print("\n".join(config["env"]))
|
||||||
print "alias cc=" + config["compiler"]
|
print("alias cc=" + config["compiler"])
|
||||||
print "\n".join(conf["before_script"])
|
print("\n".join(conf["before_script"]))
|
||||||
print "\n".join(conf["script"])
|
print("\n".join(conf["script"]))
|
||||||
print ")"
|
print(")")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
#
|
#
|
||||||
# This script needs to be run on startup
|
# This script needs to be run on startup
|
||||||
# qemu -kernel ${KERNEL} -s -S
|
# qemu -kernel ${KERNEL} -s -S
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
from layout import create_image
|
from __future__ import absolute_import
|
||||||
|
from .layout import create_image
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
UINT8 = 0xff
|
UINT8 = 0xff
|
||||||
UINT16 = 0xffff
|
UINT16 = 0xffff
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
import random
|
import random
|
||||||
import struct
|
import struct
|
||||||
import fuzz
|
from . import fuzz
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from os import urandom
|
from os import urandom
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
|
@ -36,9 +37,8 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print >>sys.stderr, \
|
print("Warning: Module for JSON processing is not found.\n" \
|
||||||
"Warning: Module for JSON processing is not found.\n" \
|
"'--config' and '--command' options are not supported.", file=sys.stderr)
|
||||||
"'--config' and '--command' options are not supported."
|
|
||||||
|
|
||||||
# Backing file sizes in MB
|
# Backing file sizes in MB
|
||||||
MAX_BACKING_FILE_SIZE = 10
|
MAX_BACKING_FILE_SIZE = 10
|
||||||
|
@ -128,7 +128,7 @@ class TestEnv(object):
|
||||||
if seed is not None:
|
if seed is not None:
|
||||||
self.seed = seed
|
self.seed = seed
|
||||||
else:
|
else:
|
||||||
self.seed = str(random.randint(0, sys.maxint))
|
self.seed = str(random.randint(0, sys.maxsize))
|
||||||
random.seed(self.seed)
|
random.seed(self.seed)
|
||||||
|
|
||||||
self.init_path = os.getcwd()
|
self.init_path = os.getcwd()
|
||||||
|
@ -158,9 +158,8 @@ class TestEnv(object):
|
||||||
try:
|
try:
|
||||||
os.makedirs(self.current_dir)
|
os.makedirs(self.current_dir)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, \
|
print("Error: The working directory '%s' cannot be used. Reason: %s"\
|
||||||
"Error: The working directory '%s' cannot be used. Reason: %s"\
|
% (self.work_dir, e[1]), file=sys.stderr)
|
||||||
% (self.work_dir, e[1])
|
|
||||||
raise TestException
|
raise TestException
|
||||||
self.log = open(os.path.join(self.current_dir, "test.log"), "w")
|
self.log = open(os.path.join(self.current_dir, "test.log"), "w")
|
||||||
self.parent_log = open(run_log, "a")
|
self.parent_log = open(run_log, "a")
|
||||||
|
@ -277,7 +276,7 @@ class TestEnv(object):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print """
|
print("""
|
||||||
Usage: runner.py [OPTION...] TEST_DIR IMG_GENERATOR
|
Usage: runner.py [OPTION...] TEST_DIR IMG_GENERATOR
|
||||||
|
|
||||||
Set up test environment in TEST_DIR and run a test in it. A module for
|
Set up test environment in TEST_DIR and run a test in it. A module for
|
||||||
|
@ -326,7 +325,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
If '--config' argument is specified, fields not listed in
|
If '--config' argument is specified, fields not listed in
|
||||||
the configuration array will not be fuzzed.
|
the configuration array will not be fuzzed.
|
||||||
"""
|
""")
|
||||||
|
|
||||||
def run_test(test_id, seed, work_dir, run_log, cleanup, log_all,
|
def run_test(test_id, seed, work_dir, run_log, cleanup, log_all,
|
||||||
command, fuzz_config):
|
command, fuzz_config):
|
||||||
|
@ -357,8 +356,7 @@ if __name__ == '__main__':
|
||||||
['command=', 'help', 'seed=', 'config=',
|
['command=', 'help', 'seed=', 'config=',
|
||||||
'keep_passed', 'verbose', 'duration='])
|
'keep_passed', 'verbose', 'duration='])
|
||||||
except getopt.error as e:
|
except getopt.error as e:
|
||||||
print >>sys.stderr, \
|
print("Error: %s\n\nTry 'runner.py --help' for more information" % e, file=sys.stderr)
|
||||||
"Error: %s\n\nTry 'runner.py --help' for more information" % e
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
command = None
|
command = None
|
||||||
|
@ -375,9 +373,8 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
command = json.loads(arg)
|
command = json.loads(arg)
|
||||||
except (TypeError, ValueError, NameError) as e:
|
except (TypeError, ValueError, NameError) as e:
|
||||||
print >>sys.stderr, \
|
print("Error: JSON array of test commands cannot be loaded.\n" \
|
||||||
"Error: JSON array of test commands cannot be loaded.\n" \
|
"Reason: %s" % e, file=sys.stderr)
|
||||||
"Reason: %s" % e
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif opt in ('-k', '--keep_passed'):
|
elif opt in ('-k', '--keep_passed'):
|
||||||
cleanup = False
|
cleanup = False
|
||||||
|
@ -391,15 +388,13 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
config = json.loads(arg)
|
config = json.loads(arg)
|
||||||
except (TypeError, ValueError, NameError) as e:
|
except (TypeError, ValueError, NameError) as e:
|
||||||
print >>sys.stderr, \
|
print("Error: JSON array with the fuzzer configuration cannot" \
|
||||||
"Error: JSON array with the fuzzer configuration cannot" \
|
" be loaded\nReason: %s" % e, file=sys.stderr)
|
||||||
" be loaded\nReason: %s" % e
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not len(args) == 2:
|
if not len(args) == 2:
|
||||||
print >>sys.stderr, \
|
print("Expected two parameters\nTry 'runner.py --help'" \
|
||||||
"Expected two parameters\nTry 'runner.py --help'" \
|
" for more information.", file=sys.stderr)
|
||||||
" for more information."
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
work_dir = os.path.realpath(args[0])
|
work_dir = os.path.realpath(args[0])
|
||||||
|
@ -415,9 +410,8 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
image_generator = __import__(generator_name)
|
image_generator = __import__(generator_name)
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print >>sys.stderr, \
|
print("Error: The image generator '%s' cannot be imported.\n" \
|
||||||
"Error: The image generator '%s' cannot be imported.\n" \
|
"Reason: %s" % (generator_name, e), file=sys.stderr)
|
||||||
"Reason: %s" % (generator_name, e)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Enable core dumps
|
# Enable core dumps
|
||||||
|
@ -428,7 +422,7 @@ if __name__ == '__main__':
|
||||||
test_id = count(1)
|
test_id = count(1)
|
||||||
while should_continue(duration, start_time):
|
while should_continue(duration, start_time):
|
||||||
try:
|
try:
|
||||||
run_test(str(test_id.next()), seed, work_dir, run_log, cleanup,
|
run_test(str(next(test_id)), seed, work_dir, run_log, cleanup,
|
||||||
log_all, command, config)
|
log_all, command, config)
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
#
|
#
|
||||||
# Migration test main engine
|
# Migration test main engine
|
||||||
#
|
#
|
||||||
|
@ -117,7 +118,7 @@ class Engine(object):
|
||||||
# XXX how to get dst timings on remote host ?
|
# XXX how to get dst timings on remote host ?
|
||||||
|
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "Sleeping %d seconds for initial guest workload run" % self._sleep
|
print("Sleeping %d seconds for initial guest workload run" % self._sleep)
|
||||||
sleep_secs = self._sleep
|
sleep_secs = self._sleep
|
||||||
while sleep_secs > 1:
|
while sleep_secs > 1:
|
||||||
src_qemu_time.append(self._cpu_timing(src_pid))
|
src_qemu_time.append(self._cpu_timing(src_pid))
|
||||||
|
@ -126,7 +127,7 @@ class Engine(object):
|
||||||
sleep_secs -= 1
|
sleep_secs -= 1
|
||||||
|
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "Starting migration"
|
print("Starting migration")
|
||||||
if scenario._auto_converge:
|
if scenario._auto_converge:
|
||||||
resp = src.command("migrate-set-capabilities",
|
resp = src.command("migrate-set-capabilities",
|
||||||
capabilities = [
|
capabilities = [
|
||||||
|
@ -216,7 +217,7 @@ class Engine(object):
|
||||||
|
|
||||||
if progress._status == "completed":
|
if progress._status == "completed":
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "Sleeping %d seconds for final guest workload run" % self._sleep
|
print("Sleeping %d seconds for final guest workload run" % self._sleep)
|
||||||
sleep_secs = self._sleep
|
sleep_secs = self._sleep
|
||||||
while sleep_secs > 1:
|
while sleep_secs > 1:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -227,23 +228,23 @@ class Engine(object):
|
||||||
return [progress_history, src_qemu_time, src_vcpu_time]
|
return [progress_history, src_qemu_time, src_vcpu_time]
|
||||||
|
|
||||||
if self._verbose and (loop % 20) == 0:
|
if self._verbose and (loop % 20) == 0:
|
||||||
print "Iter %d: remain %5dMB of %5dMB (total %5dMB @ %5dMb/sec)" % (
|
print("Iter %d: remain %5dMB of %5dMB (total %5dMB @ %5dMb/sec)" % (
|
||||||
progress._ram._iterations,
|
progress._ram._iterations,
|
||||||
progress._ram._remaining_bytes / (1024 * 1024),
|
progress._ram._remaining_bytes / (1024 * 1024),
|
||||||
progress._ram._total_bytes / (1024 * 1024),
|
progress._ram._total_bytes / (1024 * 1024),
|
||||||
progress._ram._transferred_bytes / (1024 * 1024),
|
progress._ram._transferred_bytes / (1024 * 1024),
|
||||||
progress._ram._transfer_rate_mbs,
|
progress._ram._transfer_rate_mbs,
|
||||||
)
|
))
|
||||||
|
|
||||||
if progress._ram._iterations > scenario._max_iters:
|
if progress._ram._iterations > scenario._max_iters:
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "No completion after %d iterations over RAM" % scenario._max_iters
|
print("No completion after %d iterations over RAM" % scenario._max_iters)
|
||||||
src.command("migrate_cancel")
|
src.command("migrate_cancel")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if time.time() > (start + scenario._max_time):
|
if time.time() > (start + scenario._max_time):
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "No completion after %d seconds" % scenario._max_time
|
print("No completion after %d seconds" % scenario._max_time)
|
||||||
src.command("migrate_cancel")
|
src.command("migrate_cancel")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -251,7 +252,7 @@ class Engine(object):
|
||||||
progress._ram._iterations >= scenario._post_copy_iters and
|
progress._ram._iterations >= scenario._post_copy_iters and
|
||||||
not post_copy):
|
not post_copy):
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "Switching to post-copy after %d iterations" % scenario._post_copy_iters
|
print("Switching to post-copy after %d iterations" % scenario._post_copy_iters)
|
||||||
resp = src.command("migrate-start-postcopy")
|
resp = src.command("migrate-start-postcopy")
|
||||||
post_copy = True
|
post_copy = True
|
||||||
|
|
||||||
|
@ -259,7 +260,7 @@ class Engine(object):
|
||||||
progress._ram._iterations >= scenario._pause_iters and
|
progress._ram._iterations >= scenario._pause_iters and
|
||||||
not paused):
|
not paused):
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "Pausing VM after %d iterations" % scenario._pause_iters
|
print("Pausing VM after %d iterations" % scenario._pause_iters)
|
||||||
resp = src.command("stop")
|
resp = src.command("stop")
|
||||||
paused = True
|
paused = True
|
||||||
|
|
||||||
|
@ -348,7 +349,7 @@ class Engine(object):
|
||||||
if not log:
|
if not log:
|
||||||
return []
|
return []
|
||||||
if self._debug:
|
if self._debug:
|
||||||
print log
|
print(log)
|
||||||
|
|
||||||
regex = r"[^\s]+\s\((\d+)\):\sINFO:\s(\d+)ms\scopied\s\d+\sGB\sin\s(\d+)ms"
|
regex = r"[^\s]+\s\((\d+)\):\sINFO:\s(\d+)ms\scopied\s\d+\sGB\sin\s(\d+)ms"
|
||||||
matcher = re.compile(regex)
|
matcher = re.compile(regex)
|
||||||
|
@ -407,7 +408,7 @@ class Engine(object):
|
||||||
if uri[0:5] == "unix:":
|
if uri[0:5] == "unix:":
|
||||||
os.remove(uri[5:])
|
os.remove(uri[5:])
|
||||||
if self._verbose:
|
if self._verbose:
|
||||||
print "Finished migration"
|
print("Finished migration")
|
||||||
|
|
||||||
src.shutdown()
|
src.shutdown()
|
||||||
dst.shutdown()
|
dst.shutdown()
|
||||||
|
@ -420,7 +421,7 @@ class Engine(object):
|
||||||
self._initrd, self._transport, self._sleep)
|
self._initrd, self._transport, self._sleep)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if self._debug:
|
if self._debug:
|
||||||
print "Failed: %s" % str(e)
|
print("Failed: %s" % str(e))
|
||||||
try:
|
try:
|
||||||
src.shutdown()
|
src.shutdown()
|
||||||
except:
|
except:
|
||||||
|
@ -431,7 +432,7 @@ class Engine(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self._debug:
|
if self._debug:
|
||||||
print src.get_log()
|
print(src.get_log())
|
||||||
print dst.get_log()
|
print(dst.get_log())
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
#
|
#
|
||||||
# Migration test graph plotting
|
# Migration test graph plotting
|
||||||
#
|
#
|
||||||
|
@ -588,7 +589,7 @@ class Plot(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def generate_html(self, fh):
|
def generate_html(self, fh):
|
||||||
print >>fh, """<html>
|
print("""<html>
|
||||||
<head>
|
<head>
|
||||||
<script type="text/javascript" src="plotly.min.js">
|
<script type="text/javascript" src="plotly.min.js">
|
||||||
</script>
|
</script>
|
||||||
|
@ -601,19 +602,19 @@ class Plot(object):
|
||||||
<h1>Migration report</h1>
|
<h1>Migration report</h1>
|
||||||
<h2>Chart summary</h2>
|
<h2>Chart summary</h2>
|
||||||
<div id="chart">
|
<div id="chart">
|
||||||
""" % self._generate_style()
|
""" % self._generate_style(), file=fh)
|
||||||
print >>fh, self._generate_chart()
|
print(self._generate_chart(), file=fh)
|
||||||
print >>fh, """
|
print("""
|
||||||
</div>
|
</div>
|
||||||
<h2>Report details</h2>
|
<h2>Report details</h2>
|
||||||
<div id="report">
|
<div id="report">
|
||||||
"""
|
""", file=fh)
|
||||||
print >>fh, self._generate_report()
|
print(self._generate_report(), file=fh)
|
||||||
print >>fh, """
|
print("""
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"""
|
""", file=fh)
|
||||||
|
|
||||||
def generate(self, filename):
|
def generate(self, filename):
|
||||||
if filename is None:
|
if filename is None:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
#
|
#
|
||||||
# Migration test command line shell integration
|
# Migration test command line shell integration
|
||||||
#
|
#
|
||||||
|
@ -160,13 +161,13 @@ class Shell(BaseShell):
|
||||||
try:
|
try:
|
||||||
report = engine.run(hardware, scenario)
|
report = engine.run(hardware, scenario)
|
||||||
if args.output is None:
|
if args.output is None:
|
||||||
print report.to_json()
|
print(report.to_json())
|
||||||
else:
|
else:
|
||||||
with open(args.output, "w") as fh:
|
with open(args.output, "w") as fh:
|
||||||
print >>fh, report.to_json()
|
print(report.to_json(), file=fh)
|
||||||
return 0
|
return 0
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print >>sys.stderr, "Error: %s" % str(e)
|
print("Error: %s" % str(e), file=sys.stderr)
|
||||||
if args.debug:
|
if args.debug:
|
||||||
raise
|
raise
|
||||||
return 1
|
return 1
|
||||||
|
@ -199,11 +200,11 @@ class BatchShell(BaseShell):
|
||||||
name = os.path.join(comparison._name, scenario._name)
|
name = os.path.join(comparison._name, scenario._name)
|
||||||
if not fnmatch.fnmatch(name, args.filter):
|
if not fnmatch.fnmatch(name, args.filter):
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print "Skipping %s" % name
|
print("Skipping %s" % name)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print "Running %s" % name
|
print("Running %s" % name)
|
||||||
|
|
||||||
dirname = os.path.join(args.output, comparison._name)
|
dirname = os.path.join(args.output, comparison._name)
|
||||||
filename = os.path.join(dirname, scenario._name + ".json")
|
filename = os.path.join(dirname, scenario._name + ".json")
|
||||||
|
@ -211,9 +212,9 @@ class BatchShell(BaseShell):
|
||||||
os.makedirs(dirname)
|
os.makedirs(dirname)
|
||||||
report = engine.run(hardware, scenario)
|
report = engine.run(hardware, scenario)
|
||||||
with open(filename, "w") as fh:
|
with open(filename, "w") as fh:
|
||||||
print >>fh, report.to_json()
|
print(report.to_json(), file=fh)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print >>sys.stderr, "Error: %s" % str(e)
|
print("Error: %s" % str(e), file=sys.stderr)
|
||||||
if args.debug:
|
if args.debug:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -246,14 +247,14 @@ class PlotShell(object):
|
||||||
|
|
||||||
|
|
||||||
if len(args.reports) == 0:
|
if len(args.reports) == 0:
|
||||||
print >>sys.stderr, "At least one report required"
|
print("At least one report required", file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if not (args.qemu_cpu or
|
if not (args.qemu_cpu or
|
||||||
args.vcpu_cpu or
|
args.vcpu_cpu or
|
||||||
args.total_guest_cpu or
|
args.total_guest_cpu or
|
||||||
args.split_guest_cpu):
|
args.split_guest_cpu):
|
||||||
print >>sys.stderr, "At least one chart type is required"
|
print("At least one chart type is required", file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
reports = []
|
reports = []
|
||||||
|
|
|
@ -237,7 +237,7 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
|
||||||
if name:
|
if name:
|
||||||
self.assertEqual(info["group"], name)
|
self.assertEqual(info["group"], name)
|
||||||
else:
|
else:
|
||||||
self.assertFalse(info.has_key('group'))
|
self.assertFalse('group' in info)
|
||||||
return
|
return
|
||||||
|
|
||||||
raise Exception("No group information found for '%s'" % device)
|
raise Exception("No group information found for '%s'" % device)
|
||||||
|
|
|
@ -53,9 +53,9 @@ class TestLiveSnapshot(iotests.QMPTestCase):
|
||||||
self.assertEqual(r['iops'], self.iops)
|
self.assertEqual(r['iops'], self.iops)
|
||||||
self.assertEqual(r['iops_size'], self.iops_size)
|
self.assertEqual(r['iops_size'], self.iops_size)
|
||||||
else:
|
else:
|
||||||
self.assertFalse(r.has_key('group'))
|
self.assertFalse('group' in r)
|
||||||
self.assertEqual(r['iops'], 0)
|
self.assertEqual(r['iops'], 0)
|
||||||
self.assertFalse(r.has_key('iops_size'))
|
self.assertFalse('iops_size' in r)
|
||||||
|
|
||||||
def testSnapshot(self):
|
def testSnapshot(self):
|
||||||
self.checkConfig('base')
|
self.checkConfig('base')
|
||||||
|
|
|
@ -390,14 +390,14 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.vm.shutdown()
|
self.vm.shutdown()
|
||||||
os.chmod(old_img, 0666)
|
os.chmod(old_img, 0o666)
|
||||||
os.chmod(new_img, 0666)
|
os.chmod(new_img, 0o666)
|
||||||
os.remove(old_img)
|
os.remove(old_img)
|
||||||
os.remove(new_img)
|
os.remove(new_img)
|
||||||
|
|
||||||
def test_ro_ro_retain(self):
|
def test_ro_ro_retain(self):
|
||||||
os.chmod(old_img, 0444)
|
os.chmod(old_img, 0o444)
|
||||||
os.chmod(new_img, 0444)
|
os.chmod(new_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -417,7 +417,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
||||||
|
|
||||||
def test_ro_rw_retain(self):
|
def test_ro_rw_retain(self):
|
||||||
os.chmod(old_img, 0444)
|
os.chmod(old_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -437,7 +437,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
||||||
|
|
||||||
def test_rw_ro_retain(self):
|
def test_rw_ro_retain(self):
|
||||||
os.chmod(new_img, 0444)
|
os.chmod(new_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk', 'none')
|
self.vm.add_drive(old_img, 'media=disk', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -459,7 +459,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
|
||||||
|
|
||||||
def test_ro_rw(self):
|
def test_ro_rw(self):
|
||||||
os.chmod(old_img, 0444)
|
os.chmod(old_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -480,7 +480,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
||||||
|
|
||||||
def test_rw_ro(self):
|
def test_rw_ro(self):
|
||||||
os.chmod(new_img, 0444)
|
os.chmod(new_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk', 'none')
|
self.vm.add_drive(old_img, 'media=disk', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -521,7 +521,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
||||||
|
|
||||||
def test_make_ro_rw(self):
|
def test_make_ro_rw(self):
|
||||||
os.chmod(new_img, 0444)
|
os.chmod(new_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk', 'none')
|
self.vm.add_drive(old_img, 'media=disk', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -542,7 +542,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
|
||||||
|
|
||||||
def test_make_rw_ro_by_retain(self):
|
def test_make_rw_ro_by_retain(self):
|
||||||
os.chmod(old_img, 0444)
|
os.chmod(old_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
self.vm.add_drive(old_img, 'media=disk,read-only=on', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -562,7 +562,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
|
||||||
|
|
||||||
def test_make_ro_rw_by_retain(self):
|
def test_make_ro_rw_by_retain(self):
|
||||||
os.chmod(new_img, 0444)
|
os.chmod(new_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk', 'none')
|
self.vm.add_drive(old_img, 'media=disk', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
@ -582,7 +582,7 @@ class TestChangeReadOnly(ChangeBaseClass):
|
||||||
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
|
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)
|
||||||
|
|
||||||
def test_rw_ro_cycle(self):
|
def test_rw_ro_cycle(self):
|
||||||
os.chmod(new_img, 0444)
|
os.chmod(new_img, 0o444)
|
||||||
self.vm.add_drive(old_img, 'media=disk', 'none')
|
self.vm.add_drive(old_img, 'media=disk', 'none')
|
||||||
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
self.vm.add_device('floppy,drive=drive0,id=%s' % self.device_name)
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
|
|
@ -203,7 +203,7 @@ sector = "%d"
|
||||||
if (self.accounted_ops(read = True, write = True, flush = True) != 0):
|
if (self.accounted_ops(read = True, write = True, flush = True) != 0):
|
||||||
self.assertLess(0, stats['idle_time_ns'])
|
self.assertLess(0, stats['idle_time_ns'])
|
||||||
else:
|
else:
|
||||||
self.assertFalse(stats.has_key('idle_time_ns'))
|
self.assertFalse('idle_time_ns' in stats)
|
||||||
|
|
||||||
# This test does not alter these, so they must be all 0
|
# This test does not alter these, so they must be all 0
|
||||||
self.assertEqual(0, stats['rd_merged'])
|
self.assertEqual(0, stats['rd_merged'])
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
# Exercise the QEMU 'luks' block driver to validate interoperability
|
# Exercise the QEMU 'luks' block driver to validate interoperability
|
||||||
# with the Linux dm-crypt + cryptsetup implementation
|
# with the Linux dm-crypt + cryptsetup implementation
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
@ -376,7 +377,7 @@ def test_once(config, qemu_img=False):
|
||||||
finally:
|
finally:
|
||||||
iotests.log("# Delete image")
|
iotests.log("# Delete image")
|
||||||
delete_image(config)
|
delete_image(config)
|
||||||
print
|
print()
|
||||||
|
|
||||||
|
|
||||||
# Obviously we only work with the luks image format
|
# Obviously we only work with the luks image format
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import iotests
|
import iotests
|
||||||
|
@ -85,7 +86,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
|
||||||
log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
|
log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
|
||||||
log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
|
log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
|
||||||
if log:
|
if log:
|
||||||
print log
|
print(log)
|
||||||
|
|
||||||
self.vm = self.mkVm()
|
self.vm = self.mkVm()
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
# Common utilities and Python wrappers for qemu-iotests
|
# Common utilities and Python wrappers for qemu-iotests
|
||||||
#
|
#
|
||||||
# Copyright (C) 2012 IBM Corp.
|
# Copyright (C) 2012 IBM Corp.
|
||||||
|
@ -248,7 +249,7 @@ def filter_img_info(output, filename):
|
||||||
def log(msg, filters=[]):
|
def log(msg, filters=[]):
|
||||||
for flt in filters:
|
for flt in filters:
|
||||||
msg = flt(msg)
|
msg = flt(msg)
|
||||||
print msg
|
print(msg)
|
||||||
|
|
||||||
class Timeout:
|
class Timeout:
|
||||||
def __init__(self, seconds, errmsg = "Timeout"):
|
def __init__(self, seconds, errmsg = "Timeout"):
|
||||||
|
@ -613,7 +614,7 @@ def notrun(reason):
|
||||||
seq = os.path.basename(sys.argv[0])
|
seq = os.path.basename(sys.argv[0])
|
||||||
|
|
||||||
open('%s/%s.notrun' % (output_dir, seq), 'wb').write(reason + '\n')
|
open('%s/%s.notrun' % (output_dir, seq), 'wb').write(reason + '\n')
|
||||||
print '%s not run: %s' % (seq, reason)
|
print('%s not run: %s' % (seq, reason))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def verify_image_format(supported_fmts=[], unsupported_fmts=[]):
|
def verify_image_format(supported_fmts=[], unsupported_fmts=[]):
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
# This work is licensed under the terms of the GNU GPL, version 2 or later.
|
# This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||||
# See the COPYING file in the top-level directory.
|
# See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
|
@ -110,7 +111,7 @@ class FaultInjectionSocket(object):
|
||||||
for rule in self.rules:
|
for rule in self.rules:
|
||||||
if rule.match(event, io):
|
if rule.match(event, io):
|
||||||
if rule.when == 0 or bufsize is None:
|
if rule.when == 0 or bufsize is None:
|
||||||
print 'Closing connection on rule match %s' % rule.name
|
print('Closing connection on rule match %s' % rule.name)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
if rule.when != -1:
|
if rule.when != -1:
|
||||||
return rule.when
|
return rule.when
|
||||||
|
@ -182,7 +183,7 @@ def handle_connection(conn, use_export):
|
||||||
elif req.type == NBD_CMD_DISC:
|
elif req.type == NBD_CMD_DISC:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print 'unrecognized command type %#02x' % req.type
|
print('unrecognized command type %#02x' % req.type)
|
||||||
break
|
break
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
@ -242,7 +243,7 @@ def open_socket(path):
|
||||||
sock = socket.socket(socket.AF_UNIX)
|
sock = socket.socket(socket.AF_UNIX)
|
||||||
sock.bind(path)
|
sock.bind(path)
|
||||||
sock.listen(0)
|
sock.listen(0)
|
||||||
print 'Listening on %s' % path
|
print('Listening on %s' % path)
|
||||||
sys.stdout.flush() # another process may be waiting, show message now
|
sys.stdout.flush() # another process may be waiting, show message now
|
||||||
return sock
|
return sock
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import struct
|
import struct
|
||||||
import string
|
import string
|
||||||
|
@ -129,8 +130,8 @@ class QcowHeader:
|
||||||
|
|
||||||
def dump(self):
|
def dump(self):
|
||||||
for f in QcowHeader.fields:
|
for f in QcowHeader.fields:
|
||||||
print "%-25s" % f[2], f[1] % self.__dict__[f[2]]
|
print("%-25s" % f[2], f[1] % self.__dict__[f[2]])
|
||||||
print ""
|
print("")
|
||||||
|
|
||||||
def dump_extensions(self):
|
def dump_extensions(self):
|
||||||
for ex in self.extensions:
|
for ex in self.extensions:
|
||||||
|
@ -141,11 +142,11 @@ class QcowHeader:
|
||||||
else:
|
else:
|
||||||
data = "<binary>"
|
data = "<binary>"
|
||||||
|
|
||||||
print "Header extension:"
|
print("Header extension:")
|
||||||
print "%-25s %#x" % ("magic", ex.magic)
|
print("%-25s %#x" % ("magic", ex.magic))
|
||||||
print "%-25s %d" % ("length", ex.length)
|
print("%-25s %d" % ("length", ex.length))
|
||||||
print "%-25s %s" % ("data", data)
|
print("%-25s %s" % ("data", data))
|
||||||
print ""
|
print("")
|
||||||
|
|
||||||
|
|
||||||
def cmd_dump_header(fd):
|
def cmd_dump_header(fd):
|
||||||
|
@ -157,12 +158,12 @@ def cmd_set_header(fd, name, value):
|
||||||
try:
|
try:
|
||||||
value = int(value, 0)
|
value = int(value, 0)
|
||||||
except:
|
except:
|
||||||
print "'%s' is not a valid number" % value
|
print("'%s' is not a valid number" % value)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
fields = (field[2] for field in QcowHeader.fields)
|
fields = (field[2] for field in QcowHeader.fields)
|
||||||
if not name in fields:
|
if not name in fields:
|
||||||
print "'%s' is not a known header field" % name
|
print("'%s' is not a known header field" % name)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
h = QcowHeader(fd)
|
h = QcowHeader(fd)
|
||||||
|
@ -173,7 +174,7 @@ def cmd_add_header_ext(fd, magic, data):
|
||||||
try:
|
try:
|
||||||
magic = int(magic, 0)
|
magic = int(magic, 0)
|
||||||
except:
|
except:
|
||||||
print "'%s' is not a valid magic number" % magic
|
print("'%s' is not a valid magic number" % magic)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
h = QcowHeader(fd)
|
h = QcowHeader(fd)
|
||||||
|
@ -188,7 +189,7 @@ def cmd_del_header_ext(fd, magic):
|
||||||
try:
|
try:
|
||||||
magic = int(magic, 0)
|
magic = int(magic, 0)
|
||||||
except:
|
except:
|
||||||
print "'%s' is not a valid magic number" % magic
|
print("'%s' is not a valid magic number" % magic)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
h = QcowHeader(fd)
|
h = QcowHeader(fd)
|
||||||
|
@ -200,7 +201,7 @@ def cmd_del_header_ext(fd, magic):
|
||||||
h.extensions.remove(ex)
|
h.extensions.remove(ex)
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
print "No such header extension"
|
print("No such header extension")
|
||||||
return
|
return
|
||||||
|
|
||||||
h.update(fd)
|
h.update(fd)
|
||||||
|
@ -211,7 +212,7 @@ def cmd_set_feature_bit(fd, group, bit):
|
||||||
if bit < 0 or bit >= 64:
|
if bit < 0 or bit >= 64:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
except:
|
except:
|
||||||
print "'%s' is not a valid bit number in range [0, 64)" % bit
|
print("'%s' is not a valid bit number in range [0, 64)" % bit)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
h = QcowHeader(fd)
|
h = QcowHeader(fd)
|
||||||
|
@ -222,7 +223,7 @@ def cmd_set_feature_bit(fd, group, bit):
|
||||||
elif group == 'autoclear':
|
elif group == 'autoclear':
|
||||||
h.autoclear_features |= 1 << bit
|
h.autoclear_features |= 1 << bit
|
||||||
else:
|
else:
|
||||||
print "'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group
|
print("'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
h.update(fd)
|
h.update(fd)
|
||||||
|
@ -248,16 +249,16 @@ def main(filename, cmd, args):
|
||||||
else:
|
else:
|
||||||
handler(fd, *args)
|
handler(fd, *args)
|
||||||
return
|
return
|
||||||
print "Unknown command '%s'" % cmd
|
print("Unknown command '%s'" % cmd)
|
||||||
finally:
|
finally:
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0]
|
print("Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0])
|
||||||
print ""
|
print("")
|
||||||
print "Supported commands:"
|
print("Supported commands:")
|
||||||
for name, handler, num_args, desc in cmds:
|
for name, handler, num_args, desc in cmds:
|
||||||
print " %-20s - %s" % (name, desc)
|
print(" %-20s - %s" % (name, desc))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# This work is licensed under the terms of the GNU GPL, version 2 or later.
|
# This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||||
# See the COPYING file in the top-level directory.
|
# See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import struct
|
import struct
|
||||||
import random
|
import random
|
||||||
|
@ -108,12 +109,12 @@ def corrupt_table_invalidate(qed, table):
|
||||||
def cmd_show(qed, *args):
|
def cmd_show(qed, *args):
|
||||||
'''show [header|l1|l2 <offset>]- Show header or l1/l2 tables'''
|
'''show [header|l1|l2 <offset>]- Show header or l1/l2 tables'''
|
||||||
if not args or args[0] == 'header':
|
if not args or args[0] == 'header':
|
||||||
print qed.header
|
print(qed.header)
|
||||||
elif args[0] == 'l1':
|
elif args[0] == 'l1':
|
||||||
print qed.l1_table
|
print(qed.l1_table)
|
||||||
elif len(args) == 2 and args[0] == 'l2':
|
elif len(args) == 2 and args[0] == 'l2':
|
||||||
offset = int(args[1])
|
offset = int(args[1])
|
||||||
print qed.read_table(offset)
|
print(qed.read_table(offset))
|
||||||
else:
|
else:
|
||||||
err('unrecognized sub-command')
|
err('unrecognized sub-command')
|
||||||
|
|
||||||
|
@ -146,7 +147,7 @@ def cmd_invalidate(qed, table_level):
|
||||||
def cmd_need_check(qed, *args):
|
def cmd_need_check(qed, *args):
|
||||||
'''need-check [on|off] - Test, set, or clear the QED_F_NEED_CHECK header bit'''
|
'''need-check [on|off] - Test, set, or clear the QED_F_NEED_CHECK header bit'''
|
||||||
if not args:
|
if not args:
|
||||||
print bool(qed.header['features'] & QED_F_NEED_CHECK)
|
print(bool(qed.header['features'] & QED_F_NEED_CHECK))
|
||||||
return
|
return
|
||||||
|
|
||||||
if args[0] == 'on':
|
if args[0] == 'on':
|
||||||
|
@ -208,11 +209,11 @@ def cmd_copy_metadata(qed, outfile):
|
||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print 'Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0]
|
print('Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0])
|
||||||
print
|
print()
|
||||||
print 'Supported commands:'
|
print('Supported commands:')
|
||||||
for cmd in sorted(x for x in globals() if x.startswith('cmd_')):
|
for cmd in sorted(x for x in globals() if x.startswith('cmd_')):
|
||||||
print globals()[cmd].__doc__
|
print(globals()[cmd].__doc__)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# the COPYING file in the top-level directory.
|
# the COPYING file in the top-level directory.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
@ -222,7 +223,7 @@ def main(vmcls):
|
||||||
try:
|
try:
|
||||||
args, argv = parse_args(vmcls.name)
|
args, argv = parse_args(vmcls.name)
|
||||||
if not argv and not args.build_qemu and not args.build_image:
|
if not argv and not args.build_qemu and not args.build_image:
|
||||||
print "Nothing to do?"
|
print("Nothing to do?")
|
||||||
return 1
|
return 1
|
||||||
logging.basicConfig(level=(logging.DEBUG if args.debug
|
logging.basicConfig(level=(logging.DEBUG if args.debug
|
||||||
else logging.WARN))
|
else logging.WARN))
|
||||||
|
|
Loading…
Reference in New Issue