Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated

gen-out-type = $(subst .,-,$(suffix $@))

qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
qapi-py = $(SRC_PATH)/scripts/qapi.py

qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h :\
$(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
Expand Down
5 changes: 2 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1186,9 +1186,8 @@ fi

# Note that if the Python conditional here evaluates True we will exit
# with status 1 which is a shell 'false' value.
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
error_exit "Cannot use '$python', Python 2.6 or later is required." \
"Note that Python 3 or later is not yet supported." \
if ! $python -c 'import sys; sys.exit(sys.version_info < (3,8))'; then
error_exit "Cannot use '$python', Python 3.8 or later is required." \
"Use --python=/path/to/python to specify a supported Python."
fi

Expand Down
2 changes: 1 addition & 1 deletion pebble.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
if args.vnc_ws:
cmd_line += "-vnc :1,websocket=4444 "

print "Executing command line: \n ", cmd_line
print("Executing command line: \n ", cmd_line)
os.system(cmd_line)


6 changes: 3 additions & 3 deletions scripts/acpi_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ def aml_package_start(offset):
lineno = lineno + 1
debug = "input line %d: %s" % (lineno, line)
#ASL listing: space, then line#, then ...., then code
pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*')
pasl = re.compile(r'^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*')
m = pasl.search(line)
if (m):
add_asl(lineno, pasl.sub("", line));
# AML listing: offset in hex, then ...., then code
paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*')
paml = re.compile(r'^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*')
m = paml.search(line)
if (m):
add_aml(m.group(1), paml.sub("", line))
Expand Down Expand Up @@ -357,7 +357,7 @@ def get_value_type(maxvalue):
return "char"

# Pretty print output
for array in output.keys():
for array in list(output.keys()):
otype = get_value_type(max(output[array]))
odata = []
for value in output[array]:
Expand Down
88 changes: 44 additions & 44 deletions scripts/analyse-9p-simpletrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,135 +79,135 @@

class VirtFSRequestTracker(simpletrace.Analyzer):
def begin(self):
print "Pretty printing 9p simpletrace log ..."
print("Pretty printing 9p simpletrace log ...")

def v9fs_rerror(self, tag, id, err):
print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")"
print("RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")")

def v9fs_version(self, tag, id, msize, version):
print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
print("TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")

def v9fs_version_return(self, tag, id, msize, version):
print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
print("RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")

def v9fs_attach(self, tag, id, fid, afid, uname, aname):
print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
print("TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")")

def v9fs_attach_return(self, tag, id, type, version, path):
print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
print("RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})")

def v9fs_stat(self, tag, id, fid):
print "TSTAT (tag =", tag, ", fid =", fid, ")"
print("TSTAT (tag =", tag, ", fid =", fid, ")")

def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
print("RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")")

def v9fs_getattr(self, tag, id, fid, request_mask):
print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
print("TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")")

def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
print("RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")")

def v9fs_walk(self, tag, id, fid, newfid, nwnames):
print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
print("TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")")

def v9fs_walk_return(self, tag, id, nwnames, qids):
print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
print("RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")")

def v9fs_open(self, tag, id, fid, mode):
print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
print("TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")")

def v9fs_open_return(self, tag, id, type, version, path, iounit):
print "ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
print("ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")

def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
print("TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")")

def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
print "RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
print("RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")

def v9fs_fsync(self, tag, id, fid, datasync):
print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
print("TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")")

def v9fs_clunk(self, tag, id, fid):
print "TCLUNK (tag =", tag, ", fid =", fid, ")"
print("TCLUNK (tag =", tag, ", fid =", fid, ")")

def v9fs_read(self, tag, id, fid, off, max_count):
print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
print("TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")")

def v9fs_read_return(self, tag, id, count, err):
print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
print("RREAD (tag =", tag, ", count =", count, ", err =", err, ")")

def v9fs_readdir(self, tag, id, fid, offset, max_count):
print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
print("TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")")

def v9fs_readdir_return(self, tag, id, count, retval):
print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
print("RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")")

def v9fs_write(self, tag, id, fid, off, count, cnt):
print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
print("TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")")

def v9fs_write_return(self, tag, id, total, err):
print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
print("RWRITE (tag =", tag, ", total =", total, ", err =", err, ")")

def v9fs_create(self, tag, id, fid, name, perm, mode):
print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
print("TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")")

def v9fs_create_return(self, tag, id, type, version, path, iounit):
print "RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
print("RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")

def v9fs_symlink(self, tag, id, fid, name, symname, gid):
print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
print("TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")")

def v9fs_symlink_return(self, tag, id, type, version, path):
print "RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
print("RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})")

def v9fs_flush(self, tag, id, flush_tag):
print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
print("TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")")

def v9fs_link(self, tag, id, dfid, oldfid, name):
print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
print("TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")")

def v9fs_remove(self, tag, id, fid):
print "TREMOVE (tag =", tag, ", fid =", fid, ")"
print("TREMOVE (tag =", tag, ", fid =", fid, ")")

def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
print("TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")")

def v9fs_mknod(self, tag, id, fid, mode, major, minor):
print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
print("TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")")

def v9fs_lock(self, tag, id, fid, type, start, length):
print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
print("TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")

def v9fs_lock_return(self, tag, id, status):
print "RLOCK (tag =", tag, ", status =", status, ")"
print("RLOCK (tag =", tag, ", status =", status, ")")

def v9fs_getlock(self, tag, id, fid, type, start, length):
print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
print("TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")

def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")"
print("RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")")

def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
print("TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")")

def v9fs_mkdir_return(self, tag, id, type, version, path, err):
print "RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
print("RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")")

def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
print("TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")")

def v9fs_xattrwalk_return(self, tag, id, size):
print "RXATTRWALK (tag =", tag, ", xattrsize =", size, ")"
print("RXATTRWALK (tag =", tag, ", xattrsize =", size, ")")

def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
print("TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")")

def v9fs_readlink(self, tag, id, fid):
print "TREADLINK (tag =", tag, ", fid =", fid, ")"
print("TREADLINK (tag =", tag, ", fid =", fid, ")")

def v9fs_readlink_return(self, tag, id, target):
print "RREADLINK (tag =", tag, ", target =", target, ")"
print("RREADLINK (tag =", tag, ", target =", target, ")")

simpletrace.run(VirtFSRequestTracker())
20 changes: 10 additions & 10 deletions scripts/analyze-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def read_migration_debug_json(self):

# Find the last NULL byte, then the first brace after that. This should
# be the beginning of our JSON data.
nulpos = data.rfind("\0")
jsonpos = data.find("{", nulpos)
nulpos = data.rfind(b"\0")
jsonpos = data.find(b"{", nulpos)

# Check backwards from there and see whether we guessed right
self.file.seek(datapos + jsonpos - 5, 0)
Expand Down Expand Up @@ -162,7 +162,7 @@ def read(self):
len = self.file.read64()
self.sizeinfo[self.name] = '0x%016x' % len
if self.write_memory:
print self.name
print(self.name)
mkdir_p('./' + os.path.dirname(self.name))
f = open('./' + self.name, "wb")
f.truncate(0)
Expand Down Expand Up @@ -359,7 +359,7 @@ def __init__(self, desc, file):
array_len = field.pop('array_len')
field['index'] = 0
new_fields.append(field)
for i in xrange(1, array_len):
for i in range(1, array_len):
c = field.copy()
c['index'] = i
new_fields.append(c)
Expand Down Expand Up @@ -426,7 +426,7 @@ def getDictArray(self, array):

def getDictOrderedDict(self, dict):
r = collections.OrderedDict()
for (key, value) in dict.items():
for (key, value) in list(dict.items()):
r[key] = self.getDictItem(value)
return r

Expand Down Expand Up @@ -558,7 +558,7 @@ def load_vmsd_json(self, file):

def getDict(self):
r = collections.OrderedDict()
for (key, value) in self.sections.items():
for (key, value) in list(self.sections.items()):
key = "%s (%d)" % ( value.section_key[0], key )
r[key] = value.getDict()
return r
Expand All @@ -584,15 +584,15 @@ def default(self, o):
dump = MigrationDump(args.file)

dump.read(desc_only = True)
print "desc.json"
print("desc.json")
f = open("desc.json", "wb")
f.truncate()
f.write(jsonenc.encode(dump.vmsd_desc))
f.close()

dump.read(write_memory = True)
dict = dump.getDict()
print "state.json"
print("state.json")
f = open("state.json", "wb")
f.truncate()
f.write(jsonenc.encode(dict))
Expand All @@ -601,10 +601,10 @@ def default(self, o):
dump = MigrationDump(args.file)
dump.read(dump_memory = args.memory)
dict = dump.getDict()
print jsonenc.encode(dict)
print(jsonenc.encode(dict))
elif args.dump == "desc":
dump = MigrationDump(args.file)
dump.read(desc_only = True)
print jsonenc.encode(dump.vmsd_desc)
print(jsonenc.encode(dump.vmsd_desc))
else:
raise Exception("Please specify either -x, -d state or -d dump")
10 changes: 5 additions & 5 deletions scripts/dump-guest-memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def guest_phys_blocks_init(self):
self.guest_phys_blocks = []

def guest_phys_blocks_append(self):
print "guest RAM blocks:"
print("guest RAM blocks:")
print ("target_start target_end host_addr message "
"count")
print ("---------------- ---------------- ---------------- ------- "
Expand Down Expand Up @@ -187,9 +187,9 @@ def guest_phys_blocks_append(self):
predecessor["target_end"] = target_end
message = "joined"

print ("%016x %016x %016x %-7s %5u" %
print(("%016x %016x %016x %-7s %5u" %
(target_start, target_end, host_addr.cast(self.uintptr_t),
message, len(self.guest_phys_blocks)))
message, len(self.guest_phys_blocks))))

def cpu_get_dump_info(self):
# We can't synchronize the registers with KVM post-mortem, and
Expand Down Expand Up @@ -309,8 +309,8 @@ def dump_iterate(self, vmcore):
for block in self.guest_phys_blocks:
cur = block["host_addr"]
left = block["target_end"] - block["target_start"]
print ("dumping range at %016x for length %016x" %
(cur.cast(self.uintptr_t), left))
print(("dumping range at %016x for length %016x" %
(cur.cast(self.uintptr_t), left)))
while (left > 0):
chunk_size = min(self.TARGET_PAGE_SIZE, left)
chunk = qemu_core.read_memory(cur, chunk_size)
Expand Down
Loading