yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-python-futurize-f-libfuturize.fixes.fix_print_with_i.patch

ae23c9
From 141ae90648a8bb4c26238cfde4d4946e6cff3108 Mon Sep 17 00:00:00 2001
ae23c9
From: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Date: Mon, 25 Jun 2018 21:23:43 +0100
ae23c9
Subject: [PATCH 02/15] python: futurize -f
ae23c9
 libfuturize.fixes.fix_print_with_import
ae23c9
ae23c9
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Message-id: <20180625212346.26440-2-ehabkost@redhat.com>
ae23c9
Patchwork-id: 81049
ae23c9
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 1/4] python: futurize -f libfuturize.fixes.fix_print_with_import
ae23c9
Bugzilla: 1571533
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
ae23c9
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
ae23c9
Change all Python code to use print as a function.
ae23c9
ae23c9
This is necessary for Python 3 compatibility.
ae23c9
ae23c9
Done using:
ae23c9
ae23c9
  $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \
ae23c9
    sort -u | grep -v README.sh4)
ae23c9
  $ futurize -w -f libfuturize.fixes.fix_print_with_import $py
ae23c9
ae23c9
Backport conflicts:
ae23c9
 * tests/docker/docker.py: class ProbeCommand doesn't exist
ae23c9
   in the RHEL8 tree
ae23c9
ae23c9
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
Acked-by: Fam Zheng <famz@redhat.com>
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Message-Id: <20180608122952.2009-2-ehabkost@redhat.com>
ae23c9
[ehabkost: fixup tests/docker/docker.py]
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
(cherry picked from commit f03868bd5653265e97b253102d77d83ea85efdea)
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 scripts/analyse-9p-simpletrace.py        | 89 ++++++++++++++++----------------
ae23c9
 scripts/analyse-locks-simpletrace.py     |  1 +
ae23c9
 scripts/analyze-migration.py             | 11 ++--
ae23c9
 scripts/device-crash-test                |  3 +-
ae23c9
 scripts/dump-guest-memory.py             |  1 +
ae23c9
 scripts/kvm/kvm_flightrecorder           | 21 ++++----
ae23c9
 scripts/kvm/vmxcap                       |  1 +
ae23c9
 scripts/qmp/qemu-ga-client               |  1 +
ae23c9
 scripts/qmp/qmp                          | 17 +++---
ae23c9
 scripts/qmp/qmp-shell                    | 35 +++++++------
ae23c9
 scripts/qmp/qom-get                      |  7 +--
ae23c9
 scripts/qmp/qom-list                     | 11 ++--
ae23c9
 scripts/qmp/qom-set                      |  5 +-
ae23c9
 scripts/qmp/qom-tree                     | 11 ++--
ae23c9
 scripts/replay-dump.py                   | 21 ++++----
ae23c9
 scripts/signrom.py                       |  1 +
ae23c9
 scripts/simpletrace.py                   |  3 +-
ae23c9
 scripts/vmstate-static-checker.py        | 85 +++++++++++++++---------------
ae23c9
 tests/docker/docker.py                   | 11 ++--
ae23c9
 tests/docker/travis.py                   | 15 +++---
ae23c9
 tests/guest-debug/test-gdbstub.py        |  1 +
ae23c9
 tests/image-fuzzer/runner.py             | 38 ++++++--------
ae23c9
 tests/migration/guestperf/engine.py      | 29 ++++++-----
ae23c9
 tests/migration/guestperf/plot.py        | 17 +++---
ae23c9
 tests/migration/guestperf/shell.py       | 19 +++----
ae23c9
 tests/qemu-iotests/149                   |  3 +-
ae23c9
 tests/qemu-iotests/165                   |  3 +-
ae23c9
 tests/qemu-iotests/iotests.py            |  5 +-
ae23c9
 tests/qemu-iotests/nbd-fault-injector.py |  7 +--
ae23c9
 tests/qemu-iotests/qcow2.py              | 39 +++++++-------
ae23c9
 tests/qemu-iotests/qed.py                | 17 +++---
ae23c9
 tests/vm/basevm.py                       |  3 +-
ae23c9
 32 files changed, 278 insertions(+), 253 deletions(-)
ae23c9
ae23c9
diff --git a/scripts/analyse-9p-simpletrace.py b/scripts/analyse-9p-simpletrace.py
ae23c9
index 3c3dee4..710e01a 100755
ae23c9
--- a/scripts/analyse-9p-simpletrace.py
ae23c9
+++ b/scripts/analyse-9p-simpletrace.py
ae23c9
@@ -3,6 +3,7 @@
ae23c9
 # Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid>
ae23c9
 #
ae23c9
 # Author: Harsh Prateek Bora
ae23c9
+from __future__ import print_function
ae23c9
 import os
ae23c9
 import simpletrace
ae23c9
 
ae23c9
@@ -79,135 +80,135 @@ symbol_9p = {
ae23c9
 
ae23c9
 class VirtFSRequestTracker(simpletrace.Analyzer):
ae23c9
         def begin(self):
ae23c9
-                print "Pretty printing 9p simpletrace log ..."
ae23c9
+                print("Pretty printing 9p simpletrace log ...")
ae23c9
 
ae23c9
         def v9fs_rerror(self, tag, id, err):
ae23c9
-                print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")"
ae23c9
+                print("RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")")
ae23c9
 
ae23c9
         def v9fs_version(self, tag, id, msize, version):
ae23c9
-                print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
ae23c9
+                print("TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")
ae23c9
 
ae23c9
         def v9fs_version_return(self, tag, id, msize, version):
ae23c9
-                print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
ae23c9
+                print("RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")
ae23c9
 
ae23c9
         def v9fs_attach(self, tag, id, fid, afid, uname, aname):
ae23c9
-                print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
ae23c9
+                print("TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")")
ae23c9
 
ae23c9
         def v9fs_attach_return(self, tag, id, type, version, path):
ae23c9
-                print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
ae23c9
+                print("RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})")
ae23c9
 
ae23c9
         def v9fs_stat(self, tag, id, fid):
ae23c9
-                print "TSTAT (tag =", tag, ", fid =", fid, ")"
ae23c9
+                print("TSTAT (tag =", tag, ", fid =", fid, ")")
ae23c9
 
ae23c9
         def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
ae23c9
-                print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
ae23c9
+                print("RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")")
ae23c9
 
ae23c9
         def v9fs_getattr(self, tag, id, fid, request_mask):
ae23c9
-                print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
ae23c9
+                print("TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")")
ae23c9
 
ae23c9
         def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
ae23c9
-                print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
ae23c9
+                print("RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")")
ae23c9
 
ae23c9
         def v9fs_walk(self, tag, id, fid, newfid, nwnames):
ae23c9
-                print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
ae23c9
+                print("TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")")
ae23c9
 
ae23c9
         def v9fs_walk_return(self, tag, id, nwnames, qids):
ae23c9
-                print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
ae23c9
+                print("RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")")
ae23c9
 
ae23c9
         def v9fs_open(self, tag, id, fid, mode):
ae23c9
-                print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
ae23c9
+                print("TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")")
ae23c9
 
ae23c9
         def v9fs_open_return(self, tag, id, type, version, path, iounit):
ae23c9
-                print "ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
ae23c9
+                print("ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
ae23c9
 
ae23c9
         def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
ae23c9
-                print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
ae23c9
+                print("TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")")
ae23c9
 
ae23c9
         def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
ae23c9
-                print "RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
ae23c9
+                print("RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
ae23c9
 
ae23c9
         def v9fs_fsync(self, tag, id, fid, datasync):
ae23c9
-                print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
ae23c9
+                print("TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")")
ae23c9
 
ae23c9
         def v9fs_clunk(self, tag, id, fid):
ae23c9
-                print "TCLUNK (tag =", tag, ", fid =", fid, ")"
ae23c9
+                print("TCLUNK (tag =", tag, ", fid =", fid, ")")
ae23c9
 
ae23c9
         def v9fs_read(self, tag, id, fid, off, max_count):
ae23c9
-                print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
ae23c9
+                print("TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")")
ae23c9
 
ae23c9
         def v9fs_read_return(self, tag, id, count, err):
ae23c9
-                print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
ae23c9
+                print("RREAD (tag =", tag, ", count =", count, ", err =", err, ")")
ae23c9
 
ae23c9
         def v9fs_readdir(self, tag, id, fid, offset, max_count):
ae23c9
-                print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
ae23c9
+                print("TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")")
ae23c9
 
ae23c9
         def v9fs_readdir_return(self, tag, id, count, retval):
ae23c9
-                print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
ae23c9
+                print("RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")")
ae23c9
 
ae23c9
         def v9fs_write(self, tag, id, fid, off, count, cnt):
ae23c9
-                print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
ae23c9
+                print("TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")")
ae23c9
 
ae23c9
         def v9fs_write_return(self, tag, id, total, err):
ae23c9
-                print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
ae23c9
+                print("RWRITE (tag =", tag, ", total =", total, ", err =", err, ")")
ae23c9
 
ae23c9
         def v9fs_create(self, tag, id, fid, name, perm, mode):
ae23c9
-                print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
ae23c9
+                print("TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")")
ae23c9
 
ae23c9
         def v9fs_create_return(self, tag, id, type, version, path, iounit):
ae23c9
-                print "RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
ae23c9
+                print("RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
ae23c9
 
ae23c9
         def v9fs_symlink(self, tag, id, fid, name, symname, gid):
ae23c9
-                print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
ae23c9
+                print("TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")")
ae23c9
 
ae23c9
         def v9fs_symlink_return(self, tag, id, type, version, path):
ae23c9
-                print "RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})"
ae23c9
+                print("RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})")
ae23c9
 
ae23c9
         def v9fs_flush(self, tag, id, flush_tag):
ae23c9
-                print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
ae23c9
+                print("TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")")
ae23c9
 
ae23c9
         def v9fs_link(self, tag, id, dfid, oldfid, name):
ae23c9
-                print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
ae23c9
+                print("TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")")
ae23c9
 
ae23c9
         def v9fs_remove(self, tag, id, fid):
ae23c9
-                print "TREMOVE (tag =", tag, ", fid =", fid, ")"
ae23c9
+                print("TREMOVE (tag =", tag, ", fid =", fid, ")")
ae23c9
 
ae23c9
         def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
ae23c9
-                print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
ae23c9
+                print("TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")")
ae23c9
 
ae23c9
         def v9fs_mknod(self, tag, id, fid, mode, major, minor):
ae23c9
-                print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
ae23c9
+                print("TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")")
ae23c9
 
ae23c9
         def v9fs_lock(self, tag, id, fid, type, start, length):
ae23c9
-                print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
ae23c9
+                print("TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")
ae23c9
 
ae23c9
         def v9fs_lock_return(self, tag, id, status):
ae23c9
-                print "RLOCK (tag =", tag, ", status =", status, ")"
ae23c9
+                print("RLOCK (tag =", tag, ", status =", status, ")")
ae23c9
 
ae23c9
         def v9fs_getlock(self, tag, id, fid, type, start, length):
ae23c9
-                print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
ae23c9
+                print("TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")
ae23c9
 
ae23c9
         def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
ae23c9
-                print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")"
ae23c9
+                print("RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")")
ae23c9
 
ae23c9
         def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
ae23c9
-                print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
ae23c9
+                print("TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")")
ae23c9
 
ae23c9
         def v9fs_mkdir_return(self, tag, id, type, version, path, err):
ae23c9
-                print "RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
ae23c9
+                print("RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")")
ae23c9
 
ae23c9
         def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
ae23c9
-                print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
ae23c9
+                print("TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")")
ae23c9
 
ae23c9
         def v9fs_xattrwalk_return(self, tag, id, size):
ae23c9
-                print "RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")"
ae23c9
+                print("RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")")
ae23c9
 
ae23c9
         def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
ae23c9
-                print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
ae23c9
+                print("TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")")
ae23c9
 
ae23c9
         def v9fs_readlink(self, tag, id, fid):
ae23c9
-                print "TREADLINK (tag =", tag, ", fid =", fid, ")"
ae23c9
+                print("TREADLINK (tag =", tag, ", fid =", fid, ")")
ae23c9
 
ae23c9
         def v9fs_readlink_return(self, tag, id, target):
ae23c9
-                print "RREADLINK (tag =", tag, ", target =", target, ")"
ae23c9
+                print("RREADLINK (tag =", tag, ", target =", target, ")")
ae23c9
 
ae23c9
 simpletrace.run(VirtFSRequestTracker())
ae23c9
diff --git a/scripts/analyse-locks-simpletrace.py b/scripts/analyse-locks-simpletrace.py
ae23c9
index 101e84d..352bc9c 100755
ae23c9
--- a/scripts/analyse-locks-simpletrace.py
ae23c9
+++ b/scripts/analyse-locks-simpletrace.py
ae23c9
@@ -6,6 +6,7 @@
ae23c9
 # Author: Alex Bennée <alex.bennee@linaro.org>
ae23c9
 #
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import os
ae23c9
 import simpletrace
ae23c9
 import argparse
ae23c9
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
ae23c9
index 88ff4ad..5c2010c 100755
ae23c9
--- a/scripts/analyze-migration.py
ae23c9
+++ b/scripts/analyze-migration.py
ae23c9
@@ -17,6 +17,7 @@
ae23c9
 # You should have received a copy of the GNU Lesser General Public
ae23c9
 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import numpy as np
ae23c9
 import json
ae23c9
 import os
ae23c9
@@ -162,7 +163,7 @@ class RamSection(object):
ae23c9
                     len = self.file.read64()
ae23c9
                     self.sizeinfo[self.name] = '0x%016x' % len
ae23c9
                     if self.write_memory:
ae23c9
-                        print self.name
ae23c9
+                        print(self.name)
ae23c9
                         mkdir_p('./' + os.path.dirname(self.name))
ae23c9
                         f = open('./' + self.name, "wb")
ae23c9
                         f.truncate(0)
ae23c9
@@ -588,7 +589,7 @@ if args.extract:
ae23c9
     dump = MigrationDump(args.file)
ae23c9
 
ae23c9
     dump.read(desc_only = True)
ae23c9
-    print "desc.json"
ae23c9
+    print("desc.json")
ae23c9
     f = open("desc.json", "wb")
ae23c9
     f.truncate()
ae23c9
     f.write(jsonenc.encode(dump.vmsd_desc))
ae23c9
@@ -596,7 +597,7 @@ if args.extract:
ae23c9
 
ae23c9
     dump.read(write_memory = True)
ae23c9
     dict = dump.getDict()
ae23c9
-    print "state.json"
ae23c9
+    print("state.json")
ae23c9
     f = open("state.json", "wb")
ae23c9
     f.truncate()
ae23c9
     f.write(jsonenc.encode(dict))
ae23c9
@@ -605,10 +606,10 @@ elif args.dump == "state":
ae23c9
     dump = MigrationDump(args.file)
ae23c9
     dump.read(dump_memory = args.memory)
ae23c9
     dict = dump.getDict()
ae23c9
-    print jsonenc.encode(dict)
ae23c9
+    print(jsonenc.encode(dict))
ae23c9
 elif args.dump == "desc":
ae23c9
     dump = MigrationDump(args.file)
ae23c9
     dump.read(desc_only = True)
ae23c9
-    print jsonenc.encode(dump.vmsd_desc)
ae23c9
+    print(jsonenc.encode(dump.vmsd_desc))
ae23c9
 else:
ae23c9
     raise Exception("Please specify either -x, -d state or -d dump")
ae23c9
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
ae23c9
index 5d17dc6..6a85c15 100755
ae23c9
--- a/scripts/device-crash-test
ae23c9
+++ b/scripts/device-crash-test
ae23c9
@@ -23,6 +23,7 @@
ae23c9
 Run QEMU with all combinations of -machine and -device types,
ae23c9
 check for crashes and unexpected errors.
ae23c9
 """
ae23c9
+from __future__ import print_function
ae23c9
 
ae23c9
 import sys
ae23c9
 import os
ae23c9
@@ -557,7 +558,7 @@ def main():
ae23c9
                 tc[k] = v
ae23c9
 
ae23c9
     if len(binariesToTest(args, tc)) == 0:
ae23c9
-        print >>sys.stderr, "No QEMU binary found"
ae23c9
+        print("No QEMU binary found", file=sys.stderr)
ae23c9
         parser.print_usage(sys.stderr)
ae23c9
         return 1
ae23c9
 
ae23c9
diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
ae23c9
index 276eebf..5a857ce 100644
ae23c9
--- a/scripts/dump-guest-memory.py
ae23c9
+++ b/scripts/dump-guest-memory.py
ae23c9
@@ -12,6 +12,7 @@ Authors:
ae23c9
 This work is licensed under the terms of the GNU GPL, version 2 or later. See
ae23c9
 the COPYING file in the top-level directory.
ae23c9
 """
ae23c9
+from __future__ import print_function
ae23c9
 
ae23c9
 import ctypes
ae23c9
 import struct
ae23c9
diff --git a/scripts/kvm/kvm_flightrecorder b/scripts/kvm/kvm_flightrecorder
ae23c9
index 7fb1c2d..54a5674 100755
ae23c9
--- a/scripts/kvm/kvm_flightrecorder
ae23c9
+++ b/scripts/kvm/kvm_flightrecorder
ae23c9
@@ -32,6 +32,7 @@
ae23c9
 # consuming CPU cycles.  No disk I/O is performed since the ring buffer holds a
ae23c9
 # fixed-size in-memory trace.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import os
ae23c9
 
ae23c9
@@ -77,8 +78,8 @@ def tail_trace():
ae23c9
         pass
ae23c9
 
ae23c9
 def usage():
ae23c9
-    print 'Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0]
ae23c9
-    print 'Control the KVM flight recorder tracing.'
ae23c9
+    print('Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0])
ae23c9
+    print('Control the KVM flight recorder tracing.')
ae23c9
     sys.exit(0)
ae23c9
 
ae23c9
 def main():
ae23c9
@@ -87,15 +88,15 @@ def main():
ae23c9
 
ae23c9
     cmd = sys.argv[1]
ae23c9
     if cmd == '--version':
ae23c9
-        print 'kvm_flightrecorder version 1.0'
ae23c9
+        print('kvm_flightrecorder version 1.0')
ae23c9
         sys.exit(0)
ae23c9
 
ae23c9
     if not os.path.isdir(tracing_dir):
ae23c9
-        print 'Unable to tracing debugfs directory, try:'
ae23c9
-        print 'mount -t debugfs none /sys/kernel/debug'
ae23c9
+        print('Unable to tracing debugfs directory, try:')
ae23c9
+        print('mount -t debugfs none /sys/kernel/debug')
ae23c9
         sys.exit(1)
ae23c9
     if not os.access(tracing_dir, os.W_OK):
ae23c9
-        print 'Unable to write to tracing debugfs directory, please run as root'
ae23c9
+        print('Unable to write to tracing debugfs directory, please run as root')
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     if cmd == 'start':
ae23c9
@@ -105,16 +106,16 @@ def main():
ae23c9
             try:
ae23c9
                 buffer_size_kb = int(sys.argv[2])
ae23c9
             except ValueError:
ae23c9
-                print 'Invalid per-cpu trace buffer size in KB'
ae23c9
+                print('Invalid per-cpu trace buffer size in KB')
ae23c9
                 sys.exit(1)
ae23c9
             write_file(trace_path('buffer_size_kb'), str(buffer_size_kb))
ae23c9
-            print 'Per-CPU ring buffer size set to %d KB' % buffer_size_kb
ae23c9
+            print('Per-CPU ring buffer size set to %d KB' % buffer_size_kb)
ae23c9
 
ae23c9
         start_tracing()
ae23c9
-        print 'KVM flight recorder enabled'
ae23c9
+        print('KVM flight recorder enabled')
ae23c9
     elif cmd == 'stop':
ae23c9
         stop_tracing()
ae23c9
-        print 'KVM flight recorder disabled'
ae23c9
+        print('KVM flight recorder disabled')
ae23c9
     elif cmd == 'dump':
ae23c9
         dump_trace()
ae23c9
     elif cmd == 'tail':
ae23c9
diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap
ae23c9
index d9a6db0..99a8146 100755
ae23c9
--- a/scripts/kvm/vmxcap
ae23c9
+++ b/scripts/kvm/vmxcap
ae23c9
@@ -10,6 +10,7 @@
ae23c9
 # This work is licensed under the terms of the GNU GPL, version 2.  See
ae23c9
 # the COPYING file in the top-level directory.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 MSR_IA32_VMX_BASIC = 0x480
ae23c9
 MSR_IA32_VMX_PINBASED_CTLS = 0x481
ae23c9
 MSR_IA32_VMX_PROCBASED_CTLS = 0x482
ae23c9
diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client
ae23c9
index 7d2a472..8510814 100755
ae23c9
--- a/scripts/qmp/qemu-ga-client
ae23c9
+++ b/scripts/qmp/qemu-ga-client
ae23c9
@@ -36,6 +36,7 @@
ae23c9
 # See also: https://wiki.qemu.org/Features/QAPI/GuestAgent
ae23c9
 #
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import base64
ae23c9
 import random
ae23c9
 
ae23c9
diff --git a/scripts/qmp/qmp b/scripts/qmp/qmp
ae23c9
index 514b539..16d3bdb 100755
ae23c9
--- a/scripts/qmp/qmp
ae23c9
+++ b/scripts/qmp/qmp
ae23c9
@@ -10,6 +10,7 @@
ae23c9
 # This work is licensed under the terms of the GNU GPLv2 or later.
ae23c9
 # See the COPYING file in the top-level directory.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys, os
ae23c9
 from qmp import QEMUMonitorProtocol
ae23c9
 
ae23c9
@@ -26,9 +27,9 @@ def print_response(rsp, prefix=[]):
ae23c9
             print_response(rsp[key], prefix + [key])
ae23c9
     else:
ae23c9
         if len(prefix):
ae23c9
-            print '%s: %s' % ('.'.join(prefix), rsp)
ae23c9
+            print('%s: %s' % ('.'.join(prefix), rsp))
ae23c9
         else:
ae23c9
-            print '%s' % (rsp)
ae23c9
+            print('%s' % (rsp))
ae23c9
 
ae23c9
 def main(args):
ae23c9
     path = None
ae23c9
@@ -53,21 +54,21 @@ def main(args):
ae23c9
             elif arg in ['help']:
ae23c9
                 os.execlp('man', 'man', 'qmp')
ae23c9
             else:
ae23c9
-                print 'Unknown argument "%s"' % arg
ae23c9
+                print('Unknown argument "%s"' % arg)
ae23c9
 
ae23c9
             args = args[1:]
ae23c9
         else:
ae23c9
             break
ae23c9
 
ae23c9
     if not path:
ae23c9
-        print "QMP path isn't set, use --path=qmp-monitor-address or set QMP_PATH"
ae23c9
+        print("QMP path isn't set, use --path=qmp-monitor-address or set QMP_PATH")
ae23c9
         return 1
ae23c9
 
ae23c9
     if len(args):
ae23c9
         command, args = args[0], args[1:]
ae23c9
     else:
ae23c9
-        print 'No command found'
ae23c9
-        print 'Usage: "qmp [--path=qmp-monitor-address] qmp-cmd arguments"'
ae23c9
+        print('No command found')
ae23c9
+        print('Usage: "qmp [--path=qmp-monitor-address] qmp-cmd arguments"')
ae23c9
         return 1
ae23c9
 
ae23c9
     if command in ['help']:
ae23c9
@@ -93,7 +94,7 @@ def main(args):
ae23c9
             os.execvp(fullcmd, [fullcmd] + args)
ae23c9
         except OSError as exc:
ae23c9
             if exc.errno == 2:
ae23c9
-                print 'Command "%s" not found.' % (fullcmd)
ae23c9
+                print('Command "%s" not found.' % (fullcmd))
ae23c9
                 return 1
ae23c9
             raise
ae23c9
         return 0
ae23c9
@@ -104,7 +105,7 @@ def main(args):
ae23c9
     arguments = {}
ae23c9
     for arg in args:
ae23c9
         if not arg.startswith('--'):
ae23c9
-            print 'Unknown argument "%s"' % arg
ae23c9
+            print('Unknown argument "%s"' % arg)
ae23c9
             return 1
ae23c9
 
ae23c9
         arg = arg[2:]
ae23c9
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
ae23c9
index be449de..b1cc7e2 100755
ae23c9
--- a/scripts/qmp/qmp-shell
ae23c9
+++ b/scripts/qmp/qmp-shell
ae23c9
@@ -65,6 +65,7 @@
ae23c9
 # which will echo back the properly formatted JSON-compliant QMP that is being
ae23c9
 # sent to QEMU, which is useful for debugging and documentation generation.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import qmp
ae23c9
 import json
ae23c9
 import ast
ae23c9
@@ -153,14 +154,14 @@ class QMPShell(qmp.QEMUMonitorProtocol):
ae23c9
                 # File not found. No problem.
ae23c9
                 pass
ae23c9
             else:
ae23c9
-                print "Failed to read history '%s'; %s" % (self._histfile, e)
ae23c9
+                print("Failed to read history '%s'; %s" % (self._histfile, e))
ae23c9
         atexit.register(self.__save_history)
ae23c9
 
ae23c9
     def __save_history(self):
ae23c9
         try:
ae23c9
             readline.write_history_file(self._histfile)
ae23c9
         except Exception as e:
ae23c9
-            print "Failed to save history file '%s'; %s" % (self._histfile, e)
ae23c9
+            print("Failed to save history file '%s'; %s" % (self._histfile, e))
ae23c9
 
ae23c9
     def __parse_value(self, val):
ae23c9
         try:
ae23c9
@@ -258,15 +259,15 @@ class QMPShell(qmp.QEMUMonitorProtocol):
ae23c9
         if self._pretty:
ae23c9
             indent = 4
ae23c9
         jsobj = json.dumps(qmp, indent=indent)
ae23c9
-        print str(jsobj)
ae23c9
+        print(str(jsobj))
ae23c9
 
ae23c9
     def _execute_cmd(self, cmdline):
ae23c9
         try:
ae23c9
             qmpcmd = self.__build_cmd(cmdline)
ae23c9
         except Exception as e:
ae23c9
-            print 'Error while parsing command line: %s' % e
ae23c9
-            print 'command format: <command-name> ',
ae23c9
-            print '[arg-name1=arg1] ... [arg-nameN=argN]'
ae23c9
+            print('Error while parsing command line: %s' % e)
ae23c9
+            print('command format: <command-name> ', end=' ')
ae23c9
+            print('[arg-name1=arg1] ... [arg-nameN=argN]')
ae23c9
             return True
ae23c9
         # For transaction mode, we may have just cached the action:
ae23c9
         if qmpcmd is None:
ae23c9
@@ -275,7 +276,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
ae23c9
             self._print(qmpcmd)
ae23c9
         resp = self.cmd_obj(qmpcmd)
ae23c9
         if resp is None:
ae23c9
-            print 'Disconnected'
ae23c9
+            print('Disconnected')
ae23c9
             return False
ae23c9
         self._print(resp)
ae23c9
         return True
ae23c9
@@ -285,12 +286,12 @@ class QMPShell(qmp.QEMUMonitorProtocol):
ae23c9
         self.__completer_setup()
ae23c9
 
ae23c9
     def show_banner(self, msg='Welcome to the QMP low-level shell!'):
ae23c9
-        print msg
ae23c9
+        print(msg)
ae23c9
         if not self._greeting:
ae23c9
-            print 'Connected'
ae23c9
+            print('Connected')
ae23c9
             return
ae23c9
         version = self._greeting['QMP']['version']['qemu']
ae23c9
-        print 'Connected to QEMU %d.%d.%d\n' % (version['major'],version['minor'],version['micro'])
ae23c9
+        print('Connected to QEMU %d.%d.%d\n' % (version['major'],version['minor'],version['micro']))
ae23c9
 
ae23c9
     def get_prompt(self):
ae23c9
         if self._transmode:
ae23c9
@@ -306,11 +307,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
ae23c9
         try:
ae23c9
             cmdline = raw_input(prompt)
ae23c9
         except EOFError:
ae23c9
-            print
ae23c9
+            print()
ae23c9
             return False
ae23c9
         if cmdline == '':
ae23c9
             for ev in self.get_events():
ae23c9
-                print ev
ae23c9
+                print(ev)
ae23c9
             self.clear_events()
ae23c9
             return True
ae23c9
         else:
ae23c9
@@ -366,24 +367,24 @@ class HMPShell(QMPShell):
ae23c9
             try:
ae23c9
                 idx = int(cmdline.split()[1])
ae23c9
                 if not 'return' in self.__cmd_passthrough('info version', idx):
ae23c9
-                    print 'bad CPU index'
ae23c9
+                    print('bad CPU index')
ae23c9
                     return True
ae23c9
                 self.__cpu_index = idx
ae23c9
             except ValueError:
ae23c9
-                print 'cpu command takes an integer argument'
ae23c9
+                print('cpu command takes an integer argument')
ae23c9
                 return True
ae23c9
         resp = self.__cmd_passthrough(cmdline, self.__cpu_index)
ae23c9
         if resp is None:
ae23c9
-            print 'Disconnected'
ae23c9
+            print('Disconnected')
ae23c9
             return False
ae23c9
         assert 'return' in resp or 'error' in resp
ae23c9
         if 'return' in resp:
ae23c9
             # Success
ae23c9
             if len(resp['return']) > 0:
ae23c9
-                print resp['return'],
ae23c9
+                print(resp['return'], end=' ')
ae23c9
         else:
ae23c9
             # Error
ae23c9
-            print '%s: %s' % (resp['error']['class'], resp['error']['desc'])
ae23c9
+            print('%s: %s' % (resp['error']['class'], resp['error']['desc']))
ae23c9
         return True
ae23c9
 
ae23c9
     def show_banner(self):
ae23c9
diff --git a/scripts/qmp/qom-get b/scripts/qmp/qom-get
ae23c9
index 0172c69..291c8bf 100755
ae23c9
--- a/scripts/qmp/qom-get
ae23c9
+++ b/scripts/qmp/qom-get
ae23c9
@@ -11,6 +11,7 @@
ae23c9
 # the COPYING file in the top-level directory.
ae23c9
 ##
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import os
ae23c9
 from qmp import QEMUMonitorProtocol
ae23c9
@@ -33,7 +34,7 @@ def usage_error(error_msg = "unspecified error"):
ae23c9
 
ae23c9
 if len(args) > 0:
ae23c9
     if args[0] == "-h":
ae23c9
-        print usage()
ae23c9
+        print(usage())
ae23c9
         exit(0);
ae23c9
     elif args[0] == "-s":
ae23c9
         try:
ae23c9
@@ -62,6 +63,6 @@ srv.connect()
ae23c9
 rsp = srv.command('qom-get', path=path, property=prop)
ae23c9
 if type(rsp) == dict:
ae23c9
     for i in rsp.keys():
ae23c9
-        print '%s: %s' % (i, rsp[i])
ae23c9
+        print('%s: %s' % (i, rsp[i]))
ae23c9
 else:
ae23c9
-    print rsp
ae23c9
+    print(rsp)
ae23c9
diff --git a/scripts/qmp/qom-list b/scripts/qmp/qom-list
ae23c9
index 1e7cc6c..cd907bb 100755
ae23c9
--- a/scripts/qmp/qom-list
ae23c9
+++ b/scripts/qmp/qom-list
ae23c9
@@ -11,6 +11,7 @@
ae23c9
 # the COPYING file in the top-level directory.
ae23c9
 ##
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import os
ae23c9
 from qmp import QEMUMonitorProtocol
ae23c9
@@ -33,7 +34,7 @@ def usage_error(error_msg = "unspecified error"):
ae23c9
 
ae23c9
 if len(args) > 0:
ae23c9
     if args[0] == "-h":
ae23c9
-        print usage()
ae23c9
+        print(usage())
ae23c9
         exit(0);
ae23c9
     elif args[0] == "-s":
ae23c9
         try:
ae23c9
@@ -52,13 +53,13 @@ srv = QEMUMonitorProtocol(socket_path)
ae23c9
 srv.connect()
ae23c9
 
ae23c9
 if len(args) == 0:
ae23c9
-    print '/'
ae23c9
+    print('/')
ae23c9
     sys.exit(0)
ae23c9
 
ae23c9
 for item in srv.command('qom-list', path=args[0]):
ae23c9
     if item['type'].startswith('child<'):
ae23c9
-        print '%s/' % item['name']
ae23c9
+        print('%s/' % item['name'])
ae23c9
     elif item['type'].startswith('link<'):
ae23c9
-        print '@%s/' % item['name']
ae23c9
+        print('@%s/' % item['name'])
ae23c9
     else:
ae23c9
-        print '%s' % item['name']
ae23c9
+        print('%s' % item['name'])
ae23c9
diff --git a/scripts/qmp/qom-set b/scripts/qmp/qom-set
ae23c9
index 94e2778..fbe4b3e 100755
ae23c9
--- a/scripts/qmp/qom-set
ae23c9
+++ b/scripts/qmp/qom-set
ae23c9
@@ -11,6 +11,7 @@
ae23c9
 # the COPYING file in the top-level directory.
ae23c9
 ##
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import os
ae23c9
 from qmp import QEMUMonitorProtocol
ae23c9
@@ -34,7 +35,7 @@ def usage_error(error_msg = "unspecified error"):
ae23c9
 
ae23c9
 if len(args) > 0:
ae23c9
     if args[0] == "-h":
ae23c9
-        print usage()
ae23c9
+        print(usage())
ae23c9
         exit(0);
ae23c9
     elif args[0] == "-s":
ae23c9
         try:
ae23c9
@@ -61,4 +62,4 @@ else:
ae23c9
 srv = QEMUMonitorProtocol(socket_path)
ae23c9
 srv.connect()
ae23c9
 
ae23c9
-print srv.command('qom-set', path=path, property=prop, value=value)
ae23c9
+print(srv.command('qom-set', path=path, property=prop, value=value))
ae23c9
diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree
ae23c9
index 906fcd2..0ffd1ff 100755
ae23c9
--- a/scripts/qmp/qom-tree
ae23c9
+++ b/scripts/qmp/qom-tree
ae23c9
@@ -13,6 +13,7 @@
ae23c9
 # the COPYING file in the top-level directory.
ae23c9
 ##
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import os
ae23c9
 from qmp import QEMUMonitorProtocol
ae23c9
@@ -35,7 +36,7 @@ def usage_error(error_msg = "unspecified error"):
ae23c9
 
ae23c9
 if len(args) > 0:
ae23c9
     if args[0] == "-h":
ae23c9
-        print usage()
ae23c9
+        print(usage())
ae23c9
         exit(0);
ae23c9
     elif args[0] == "-s":
ae23c9
         try:
ae23c9
@@ -54,15 +55,15 @@ srv = QEMUMonitorProtocol(socket_path)
ae23c9
 srv.connect()
ae23c9
 
ae23c9
 def list_node(path):
ae23c9
-    print '%s' % path
ae23c9
+    print('%s' % path)
ae23c9
     items = srv.command('qom-list', path=path)
ae23c9
     for item in items:
ae23c9
         if not item['type'].startswith('child<'):
ae23c9
             try:
ae23c9
-                print '  %s: %s (%s)' % (item['name'], srv.command('qom-get', path=path, property=item['name']), item['type'])
ae23c9
+                print('  %s: %s (%s)' % (item['name'], srv.command('qom-get', path=path, property=item['name']), item['type']))
ae23c9
             except:
ae23c9
-                print '  %s: <EXCEPTION> (%s)' % (item['name'], item['type'])
ae23c9
-    print ''
ae23c9
+                print('  %s: <EXCEPTION> (%s)' % (item['name'], item['type']))
ae23c9
+    print('')
ae23c9
     for item in items:
ae23c9
         if item['type'].startswith('child<'):
ae23c9
             list_node((path if (path != '/') else '')  + '/' + item['name'])
ae23c9
diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
ae23c9
index e274086..5ae77c8 100755
ae23c9
--- a/scripts/replay-dump.py
ae23c9
+++ b/scripts/replay-dump.py
ae23c9
@@ -18,6 +18,7 @@
ae23c9
 # You should have received a copy of the GNU Lesser General Public
ae23c9
 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import argparse
ae23c9
 import struct
ae23c9
 from collections import namedtuple
ae23c9
@@ -89,9 +90,9 @@ def call_decode(table, index, dumpfile):
ae23c9
     "Search decode table for next step"
ae23c9
     decoder = next((d for d in table if d.eid == index), None)
ae23c9
     if not decoder:
ae23c9
-        print "Could not decode index: %d" % (index)
ae23c9
-        print "Entry is: %s" % (decoder)
ae23c9
-        print "Decode Table is:\n%s" % (table)
ae23c9
+        print("Could not decode index: %d" % (index))
ae23c9
+        print("Entry is: %s" % (decoder))
ae23c9
+        print("Decode Table is:\n%s" % (table))
ae23c9
         return False
ae23c9
     else:
ae23c9
         return decoder.fn(decoder.eid, decoder.name, dumpfile)
ae23c9
@@ -103,23 +104,23 @@ def print_event(eid, name, string=None, event_count=None):
ae23c9
         event_count = replay_state.event_count
ae23c9
 
ae23c9
     if string:
ae23c9
-        print "%d:%s(%d) %s" % (event_count, name, eid, string)
ae23c9
+        print("%d:%s(%d) %s" % (event_count, name, eid, string))
ae23c9
     else:
ae23c9
-        print "%d:%s(%d)" % (event_count, name, eid)
ae23c9
+        print("%d:%s(%d)" % (event_count, name, eid))
ae23c9
 
ae23c9
 
ae23c9
 # Decoders for each event type
ae23c9
 
ae23c9
 def decode_unimp(eid, name, _unused_dumpfile):
ae23c9
     "Unimplimented decoder, will trigger exit"
ae23c9
-    print "%s not handled - will now stop" % (name)
ae23c9
+    print("%s not handled - will now stop" % (name))
ae23c9
     return False
ae23c9
 
ae23c9
 # Checkpoint decoder
ae23c9
 def swallow_async_qword(eid, name, dumpfile):
ae23c9
     "Swallow a qword of data without looking at it"
ae23c9
     step_id = read_qword(dumpfile)
ae23c9
-    print "  %s(%d) @ %d" % (name, eid, step_id)
ae23c9
+    print("  %s(%d) @ %d" % (name, eid, step_id))
ae23c9
     return True
ae23c9
 
ae23c9
 async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async_qword),
ae23c9
@@ -139,8 +140,8 @@ def decode_async(eid, name, dumpfile):
ae23c9
     async_event_checkpoint = read_byte(dumpfile)
ae23c9
 
ae23c9
     if async_event_checkpoint != replay_state.current_checkpoint:
ae23c9
-        print "  mismatch between checkpoint %d and async data %d" % (
ae23c9
-            replay_state.current_checkpoint, async_event_checkpoint)
ae23c9
+        print("  mismatch between checkpoint %d and async data %d" % (
ae23c9
+            replay_state.current_checkpoint, async_event_checkpoint))
ae23c9
         return True
ae23c9
 
ae23c9
     return call_decode(async_decode_table, async_event_kind, dumpfile)
ae23c9
@@ -283,7 +284,7 @@ def decode_file(filename):
ae23c9
     version = read_dword(dumpfile)
ae23c9
     junk = read_qword(dumpfile)
ae23c9
 
ae23c9
-    print "HEADER: version 0x%x" % (version)
ae23c9
+    print("HEADER: version 0x%x" % (version))
ae23c9
 
ae23c9
     if version == 0xe02007:
ae23c9
         event_decode_table = v7_event_table
ae23c9
diff --git a/scripts/signrom.py b/scripts/signrom.py
ae23c9
index 0497a1c..313ee28 100644
ae23c9
--- a/scripts/signrom.py
ae23c9
+++ b/scripts/signrom.py
ae23c9
@@ -1,3 +1,4 @@
ae23c9
+from __future__ import print_function
ae23c9
 #
ae23c9
 # Option ROM signing utility
ae23c9
 #
ae23c9
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
ae23c9
index 46a5fd7..54e761f 100755
ae23c9
--- a/scripts/simpletrace.py
ae23c9
+++ b/scripts/simpletrace.py
ae23c9
@@ -9,6 +9,7 @@
ae23c9
 #
ae23c9
 # For help see docs/devel/tracing.txt
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import struct
ae23c9
 import re
ae23c9
 import inspect
ae23c9
@@ -257,6 +258,6 @@ if __name__ == '__main__':
ae23c9
                 else:
ae23c9
                     fields.append('%s=0x%x' % (name, rec[i]))
ae23c9
                 i += 1
ae23c9
-            print ' '.join(fields)
ae23c9
+            print(' '.join(fields))
ae23c9
 
ae23c9
     run(Formatter())
ae23c9
diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-checker.py
ae23c9
index ffb13d1..7c97db6 100755
ae23c9
--- a/scripts/vmstate-static-checker.py
ae23c9
+++ b/scripts/vmstate-static-checker.py
ae23c9
@@ -19,6 +19,7 @@
ae23c9
 # You should have received a copy of the GNU General Public License along
ae23c9
 # with this program; if not, see <http://www.gnu.org/licenses/>.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import argparse
ae23c9
 import json
ae23c9
 import sys
ae23c9
@@ -175,10 +176,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
ae23c9
             except StopIteration:
ae23c9
                 if d_iter_list == []:
ae23c9
                     # We were not in a substruct
ae23c9
-                    print "Section \"" + sec + "\",",
ae23c9
-                    print "Description " + "\"" + desc + "\":",
ae23c9
-                    print "expected field \"" + s_item["field"] + "\",",
ae23c9
-                    print "while dest has no further fields"
ae23c9
+                    print("Section \"" + sec + "\",", end=' ')
ae23c9
+                    print("Description " + "\"" + desc + "\":", end=' ')
ae23c9
+                    print("expected field \"" + s_item["field"] + "\",", end=' ')
ae23c9
+                    print("while dest has no further fields")
ae23c9
                     bump_taint()
ae23c9
                     break
ae23c9
 
ae23c9
@@ -196,10 +197,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
ae23c9
                     advance_dest = True
ae23c9
                     continue
ae23c9
                 if unused_count < 0:
ae23c9
-                    print "Section \"" + sec + "\",",
ae23c9
-                    print "Description \"" + desc + "\":",
ae23c9
-                    print "unused size mismatch near \"",
ae23c9
-                    print s_item["field"] + "\""
ae23c9
+                    print("Section \"" + sec + "\",", end=' ')
ae23c9
+                    print("Description \"" + desc + "\":", end=' ')
ae23c9
+                    print("unused size mismatch near \"", end=' ')
ae23c9
+                    print(s_item["field"] + "\"")
ae23c9
                     bump_taint()
ae23c9
                     break
ae23c9
                 continue
ae23c9
@@ -210,10 +211,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
ae23c9
                     advance_src = True
ae23c9
                     continue
ae23c9
                 if unused_count < 0:
ae23c9
-                    print "Section \"" + sec + "\",",
ae23c9
-                    print "Description \"" + desc + "\":",
ae23c9
-                    print "unused size mismatch near \"",
ae23c9
-                    print d_item["field"] + "\""
ae23c9
+                    print("Section \"" + sec + "\",", end=' ')
ae23c9
+                    print("Description \"" + desc + "\":", end=' ')
ae23c9
+                    print("unused size mismatch near \"", end=' ')
ae23c9
+                    print(d_item["field"] + "\"")
ae23c9
                     bump_taint()
ae23c9
                     break
ae23c9
                 continue
ae23c9
@@ -261,10 +262,10 @@ def check_fields(src_fields, dest_fields, desc, sec):
ae23c9
                     unused_count = s_item["size"] - d_item["size"]
ae23c9
                     continue
ae23c9
 
ae23c9
-            print "Section \"" + sec + "\",",
ae23c9
-            print "Description \"" + desc + "\":",
ae23c9
-            print "expected field \"" + s_item["field"] + "\",",
ae23c9
-            print "got \"" + d_item["field"] + "\"; skipping rest"
ae23c9
+            print("Section \"" + sec + "\",", end=' ')
ae23c9
+            print("Description \"" + desc + "\":", end=' ')
ae23c9
+            print("expected field \"" + s_item["field"] + "\",", end=' ')
ae23c9
+            print("got \"" + d_item["field"] + "\"; skipping rest")
ae23c9
             bump_taint()
ae23c9
             break
ae23c9
 
ae23c9
@@ -288,8 +289,8 @@ def check_subsections(src_sub, dest_sub, desc, sec):
ae23c9
             check_descriptions(s_item, d_item, sec)
ae23c9
 
ae23c9
         if not found:
ae23c9
-            print "Section \"" + sec + "\", Description \"" + desc + "\":",
ae23c9
-            print "Subsection \"" + s_item["name"] + "\" not found"
ae23c9
+            print("Section \"" + sec + "\", Description \"" + desc + "\":", end=' ')
ae23c9
+            print("Subsection \"" + s_item["name"] + "\" not found")
ae23c9
             bump_taint()
ae23c9
 
ae23c9
 
ae23c9
@@ -298,8 +299,8 @@ def check_description_in_list(s_item, d_item, sec, desc):
ae23c9
         return
ae23c9
 
ae23c9
     if not "Description" in d_item:
ae23c9
-        print "Section \"" + sec + "\", Description \"" + desc + "\",",
ae23c9
-        print "Field \"" + s_item["field"] + "\": missing description"
ae23c9
+        print("Section \"" + sec + "\", Description \"" + desc + "\",", end=' ')
ae23c9
+        print("Field \"" + s_item["field"] + "\": missing description")
ae23c9
         bump_taint()
ae23c9
         return
ae23c9
 
ae23c9
@@ -310,17 +311,17 @@ def check_descriptions(src_desc, dest_desc, sec):
ae23c9
     check_version(src_desc, dest_desc, sec, src_desc["name"])
ae23c9
 
ae23c9
     if not check_fields_match(sec, src_desc["name"], dest_desc["name"]):
ae23c9
-        print "Section \"" + sec + "\":",
ae23c9
-        print "Description \"" + src_desc["name"] + "\"",
ae23c9
-        print "missing, got \"" + dest_desc["name"] + "\" instead; skipping"
ae23c9
+        print("Section \"" + sec + "\":", end=' ')
ae23c9
+        print("Description \"" + src_desc["name"] + "\"", end=' ')
ae23c9
+        print("missing, got \"" + dest_desc["name"] + "\" instead; skipping")
ae23c9
         bump_taint()
ae23c9
         return
ae23c9
 
ae23c9
     for f in src_desc:
ae23c9
         if not f in dest_desc:
ae23c9
-            print "Section \"" + sec + "\"",
ae23c9
-            print "Description \"" + src_desc["name"] + "\":",
ae23c9
-            print "Entry \"" + f + "\" missing"
ae23c9
+            print("Section \"" + sec + "\"", end=' ')
ae23c9
+            print("Description \"" + src_desc["name"] + "\":", end=' ')
ae23c9
+            print("Entry \"" + f + "\" missing")
ae23c9
             bump_taint()
ae23c9
             continue
ae23c9
 
ae23c9
@@ -333,39 +334,39 @@ def check_descriptions(src_desc, dest_desc, sec):
ae23c9
 
ae23c9
 def check_version(s, d, sec, desc=None):
ae23c9
     if s["version_id"] > d["version_id"]:
ae23c9
-        print "Section \"" + sec + "\"",
ae23c9
+        print("Section \"" + sec + "\"", end=' ')
ae23c9
         if desc:
ae23c9
-            print "Description \"" + desc + "\":",
ae23c9
-        print "version error:", s["version_id"], ">", d["version_id"]
ae23c9
+            print("Description \"" + desc + "\":", end=' ')
ae23c9
+        print("version error:", s["version_id"], ">", d["version_id"])
ae23c9
         bump_taint()
ae23c9
 
ae23c9
     if not "minimum_version_id" in d:
ae23c9
         return
ae23c9
 
ae23c9
     if s["version_id"] < d["minimum_version_id"]:
ae23c9
-        print "Section \"" + sec + "\"",
ae23c9
+        print("Section \"" + sec + "\"", end=' ')
ae23c9
         if desc:
ae23c9
-            print "Description \"" + desc + "\":",
ae23c9
-            print "minimum version error:", s["version_id"], "<",
ae23c9
-            print d["minimum_version_id"]
ae23c9
+            print("Description \"" + desc + "\":", end=' ')
ae23c9
+            print("minimum version error:", s["version_id"], "<", end=' ')
ae23c9
+            print(d["minimum_version_id"])
ae23c9
             bump_taint()
ae23c9
 
ae23c9
 
ae23c9
 def check_size(s, d, sec, desc=None, field=None):
ae23c9
     if s["size"] != d["size"]:
ae23c9
-        print "Section \"" + sec + "\"",
ae23c9
+        print("Section \"" + sec + "\"", end=' ')
ae23c9
         if desc:
ae23c9
-            print "Description \"" + desc + "\"",
ae23c9
+            print("Description \"" + desc + "\"", end=' ')
ae23c9
         if field:
ae23c9
-            print "Field \"" + field + "\"",
ae23c9
-        print "size mismatch:", s["size"], ",", d["size"]
ae23c9
+            print("Field \"" + field + "\"", end=' ')
ae23c9
+        print("size mismatch:", s["size"], ",", d["size"])
ae23c9
         bump_taint()
ae23c9
 
ae23c9
 
ae23c9
 def check_machine_type(s, d):
ae23c9
     if s["Name"] != d["Name"]:
ae23c9
-        print "Warning: checking incompatible machine types:",
ae23c9
-        print "\"" + s["Name"] + "\", \"" + d["Name"] + "\""
ae23c9
+        print("Warning: checking incompatible machine types:", end=' ')
ae23c9
+        print("\"" + s["Name"] + "\", \"" + d["Name"] + "\"")
ae23c9
     return
ae23c9
 
ae23c9
 
ae23c9
@@ -399,7 +400,7 @@ def main():
ae23c9
             # doesn't exist in dest.
ae23c9
             dest_sec = get_changed_sec_name(sec)
ae23c9
             if not dest_sec in dest_data:
ae23c9
-                print "Section \"" + sec + "\" does not exist in dest"
ae23c9
+                print("Section \"" + sec + "\" does not exist in dest")
ae23c9
                 bump_taint()
ae23c9
                 continue
ae23c9
 
ae23c9
@@ -414,8 +415,8 @@ def main():
ae23c9
 
ae23c9
         for entry in s:
ae23c9
             if not entry in d:
ae23c9
-                print "Section \"" + sec + "\": Entry \"" + entry + "\"",
ae23c9
-                print "missing"
ae23c9
+                print("Section \"" + sec + "\": Entry \"" + entry + "\"", end=' ')
ae23c9
+                print("missing")
ae23c9
                 bump_taint()
ae23c9
                 continue
ae23c9
 
ae23c9
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
ae23c9
index 1246ba9..b43f02e 100755
ae23c9
--- a/tests/docker/docker.py
ae23c9
+++ b/tests/docker/docker.py
ae23c9
@@ -11,6 +11,7 @@
ae23c9
 # or (at your option) any later version. See the COPYING file in
ae23c9
 # the top-level directory.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import os
ae23c9
 import sys
ae23c9
 sys.path.append(os.path.join(os.path.dirname(__file__),
ae23c9
@@ -87,7 +88,7 @@ def _get_so_libs(executable):
ae23c9
                 so_lib = search.groups()[1]
ae23c9
                 libs.append("%s/%s" % (so_path, so_lib))
ae23c9
     except subprocess.CalledProcessError:
ae23c9
-        print "%s had no associated libraries (static build?)" % (executable)
ae23c9
+        print("%s had no associated libraries (static build?)" % (executable))
ae23c9
 
ae23c9
     return libs
ae23c9
 
ae23c9
@@ -161,7 +162,7 @@ class Docker(object):
ae23c9
                 continue
ae23c9
             if only_known and instance_uuid not in self._instances:
ae23c9
                 continue
ae23c9
-            print "Terminating", i
ae23c9
+            print("Terminating", i)
ae23c9
             if active:
ae23c9
                 self._do(["kill", i])
ae23c9
             self._do(["rm", i])
ae23c9
@@ -288,7 +289,7 @@ class BuildCommand(SubCommand):
ae23c9
         if "--no-cache" not in argv and \
ae23c9
            dkr.image_matches_dockerfile(tag, dockerfile):
ae23c9
             if not args.quiet:
ae23c9
-                print "Image is up to date."
ae23c9
+                print("Image is up to date.")
ae23c9
         else:
ae23c9
             # Create a docker context directory for the build
ae23c9
             docker_dir = tempfile.mkdtemp(prefix="docker_build")
ae23c9
@@ -300,10 +301,10 @@ class BuildCommand(SubCommand):
ae23c9
                 rc = subprocess.call(os.path.realpath(docker_pre),
ae23c9
                                      cwd=docker_dir, stdout=stdout)
ae23c9
                 if rc == 3:
ae23c9
-                    print "Skip"
ae23c9
+                    print("Skip")
ae23c9
                     return 0
ae23c9
                 elif rc != 0:
ae23c9
-                    print "%s exited with code %d" % (docker_pre, rc)
ae23c9
+                    print("%s exited with code %d" % (docker_pre, rc))
ae23c9
                     return 1
ae23c9
 
ae23c9
             # Copy any extra files into the Docker context. These can be
ae23c9
diff --git a/tests/docker/travis.py b/tests/docker/travis.py
ae23c9
index 703a7fd..ea1ef16 100755
ae23c9
--- a/tests/docker/travis.py
ae23c9
+++ b/tests/docker/travis.py
ae23c9
@@ -11,6 +11,7 @@
ae23c9
 # or (at your option) any later version. See the COPYING file in
ae23c9
 # the top-level directory.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import yaml
ae23c9
 import itertools
ae23c9
@@ -34,14 +35,14 @@ def main():
ae23c9
         sys.stderr.write("Usage: %s <travis-file>\n" % sys.argv[0])
ae23c9
         return 1
ae23c9
     conf = load_yaml(sys.argv[1])
ae23c9
-    print "\n".join((": ${%s}" % var for var in conf["env"]["global"]))
ae23c9
+    print("\n".join((": ${%s}" % var for var in conf["env"]["global"])))
ae23c9
     for config in conf_iter(conf):
ae23c9
-        print "("
ae23c9
-        print "\n".join(config["env"])
ae23c9
-        print "alias cc=" + config["compiler"]
ae23c9
-        print "\n".join(conf["before_script"])
ae23c9
-        print "\n".join(conf["script"])
ae23c9
-        print ")"
ae23c9
+        print("(")
ae23c9
+        print("\n".join(config["env"]))
ae23c9
+        print("alias cc=" + config["compiler"])
ae23c9
+        print("\n".join(conf["before_script"]))
ae23c9
+        print("\n".join(conf["script"]))
ae23c9
+        print(")")
ae23c9
     return 0
ae23c9
 
ae23c9
 if __name__ == "__main__":
ae23c9
diff --git a/tests/guest-debug/test-gdbstub.py b/tests/guest-debug/test-gdbstub.py
ae23c9
index 31ba6c9..474d2c5 100644
ae23c9
--- a/tests/guest-debug/test-gdbstub.py
ae23c9
+++ b/tests/guest-debug/test-gdbstub.py
ae23c9
@@ -1,3 +1,4 @@
ae23c9
+from __future__ import print_function
ae23c9
 #
ae23c9
 # This script needs to be run on startup
ae23c9
 # qemu -kernel ${KERNEL} -s -S
ae23c9
diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py
ae23c9
index 96a1c11..8de6569 100755
ae23c9
--- a/tests/image-fuzzer/runner.py
ae23c9
+++ b/tests/image-fuzzer/runner.py
ae23c9
@@ -18,6 +18,7 @@
ae23c9
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae23c9
 #
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import os
ae23c9
 import signal
ae23c9
@@ -36,9 +37,8 @@ except ImportError:
ae23c9
     try:
ae23c9
         import simplejson as json
ae23c9
     except ImportError:
ae23c9
-        print >>sys.stderr, \
ae23c9
-            "Warning: Module for JSON processing is not found.\n" \
ae23c9
-            "'--config' and '--command' options are not supported."
ae23c9
+        print("Warning: Module for JSON processing is not found.\n" \
ae23c9
+            "'--config' and '--command' options are not supported.", file=sys.stderr)
ae23c9
 
ae23c9
 # Backing file sizes in MB
ae23c9
 MAX_BACKING_FILE_SIZE = 10
ae23c9
@@ -158,9 +158,8 @@ class TestEnv(object):
ae23c9
         try:
ae23c9
             os.makedirs(self.current_dir)
ae23c9
         except OSError as e:
ae23c9
-            print >>sys.stderr, \
ae23c9
-                "Error: The working directory '%s' cannot be used. Reason: %s"\
ae23c9
-                % (self.work_dir, e[1])
ae23c9
+            print("Error: The working directory '%s' cannot be used. Reason: %s"\
ae23c9
+                % (self.work_dir, e[1]), file=sys.stderr)
ae23c9
             raise TestException
ae23c9
         self.log = open(os.path.join(self.current_dir, "test.log"), "w")
ae23c9
         self.parent_log = open(run_log, "a")
ae23c9
@@ -277,7 +276,7 @@ class TestEnv(object):
ae23c9
 if __name__ == '__main__':
ae23c9
 
ae23c9
     def usage():
ae23c9
-        print """
ae23c9
+        print("""
ae23c9
         Usage: runner.py [OPTION...] TEST_DIR IMG_GENERATOR
ae23c9
 
ae23c9
         Set up test environment in TEST_DIR and run a test in it. A module for
ae23c9
@@ -326,7 +325,7 @@ if __name__ == '__main__':
ae23c9
 
ae23c9
         If '--config' argument is specified, fields not listed in
ae23c9
         the configuration array will not be fuzzed.
ae23c9
-        """
ae23c9
+        """)
ae23c9
 
ae23c9
     def run_test(test_id, seed, work_dir, run_log, cleanup, log_all,
ae23c9
                  command, fuzz_config):
ae23c9
@@ -357,8 +356,7 @@ if __name__ == '__main__':
ae23c9
                                        ['command=', 'help', 'seed=', 'config=',
ae23c9
                                         'keep_passed', 'verbose', 'duration='])
ae23c9
     except getopt.error as e:
ae23c9
-        print >>sys.stderr, \
ae23c9
-            "Error: %s\n\nTry 'runner.py --help' for more information" % e
ae23c9
+        print("Error: %s\n\nTry 'runner.py --help' for more information" % e, file=sys.stderr)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     command = None
ae23c9
@@ -375,9 +373,8 @@ if __name__ == '__main__':
ae23c9
             try:
ae23c9
                 command = json.loads(arg)
ae23c9
             except (TypeError, ValueError, NameError) as e:
ae23c9
-                print >>sys.stderr, \
ae23c9
-                    "Error: JSON array of test commands cannot be loaded.\n" \
ae23c9
-                    "Reason: %s" % e
ae23c9
+                print("Error: JSON array of test commands cannot be loaded.\n" \
ae23c9
+                    "Reason: %s" % e, file=sys.stderr)
ae23c9
                 sys.exit(1)
ae23c9
         elif opt in ('-k', '--keep_passed'):
ae23c9
             cleanup = False
ae23c9
@@ -391,15 +388,13 @@ if __name__ == '__main__':
ae23c9
             try:
ae23c9
                 config = json.loads(arg)
ae23c9
             except (TypeError, ValueError, NameError) as e:
ae23c9
-                print >>sys.stderr, \
ae23c9
-                    "Error: JSON array with the fuzzer configuration cannot" \
ae23c9
-                    " be loaded\nReason: %s" % e
ae23c9
+                print("Error: JSON array with the fuzzer configuration cannot" \
ae23c9
+                    " be loaded\nReason: %s" % e, file=sys.stderr)
ae23c9
                 sys.exit(1)
ae23c9
 
ae23c9
     if not len(args) == 2:
ae23c9
-        print >>sys.stderr, \
ae23c9
-            "Expected two parameters\nTry 'runner.py --help'" \
ae23c9
-            " for more information."
ae23c9
+        print("Expected two parameters\nTry 'runner.py --help'" \
ae23c9
+            " for more information.", file=sys.stderr)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     work_dir = os.path.realpath(args[0])
ae23c9
@@ -415,9 +410,8 @@ if __name__ == '__main__':
ae23c9
     try:
ae23c9
         image_generator = __import__(generator_name)
ae23c9
     except ImportError as e:
ae23c9
-        print >>sys.stderr, \
ae23c9
-            "Error: The image generator '%s' cannot be imported.\n" \
ae23c9
-            "Reason: %s" % (generator_name, e)
ae23c9
+        print("Error: The image generator '%s' cannot be imported.\n" \
ae23c9
+            "Reason: %s" % (generator_name, e), file=sys.stderr)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     # Enable core dumps
ae23c9
diff --git a/tests/migration/guestperf/engine.py b/tests/migration/guestperf/engine.py
ae23c9
index e14d432..398e3f2 100644
ae23c9
--- a/tests/migration/guestperf/engine.py
ae23c9
+++ b/tests/migration/guestperf/engine.py
ae23c9
@@ -1,3 +1,4 @@
ae23c9
+from __future__ import print_function
ae23c9
 #
ae23c9
 # Migration test main engine
ae23c9
 #
ae23c9
@@ -117,7 +118,7 @@ class Engine(object):
ae23c9
         # XXX how to get dst timings on remote host ?
ae23c9
 
ae23c9
         if self._verbose:
ae23c9
-            print "Sleeping %d seconds for initial guest workload run" % self._sleep
ae23c9
+            print("Sleeping %d seconds for initial guest workload run" % self._sleep)
ae23c9
         sleep_secs = self._sleep
ae23c9
         while sleep_secs > 1:
ae23c9
             src_qemu_time.append(self._cpu_timing(src_pid))
ae23c9
@@ -126,7 +127,7 @@ class Engine(object):
ae23c9
             sleep_secs -= 1
ae23c9
 
ae23c9
         if self._verbose:
ae23c9
-            print "Starting migration"
ae23c9
+            print("Starting migration")
ae23c9
         if scenario._auto_converge:
ae23c9
             resp = src.command("migrate-set-capabilities",
ae23c9
                                capabilities = [
ae23c9
@@ -216,7 +217,7 @@ class Engine(object):
ae23c9
 
ae23c9
                 if progress._status == "completed":
ae23c9
                     if self._verbose:
ae23c9
-                        print "Sleeping %d seconds for final guest workload run" % self._sleep
ae23c9
+                        print("Sleeping %d seconds for final guest workload run" % self._sleep)
ae23c9
                     sleep_secs = self._sleep
ae23c9
                     while sleep_secs > 1:
ae23c9
                         time.sleep(1)
ae23c9
@@ -227,23 +228,23 @@ class Engine(object):
ae23c9
                 return [progress_history, src_qemu_time, src_vcpu_time]
ae23c9
 
ae23c9
             if self._verbose and (loop % 20) == 0:
ae23c9
-                print "Iter %d: remain %5dMB of %5dMB (total %5dMB @ %5dMb/sec)" % (
ae23c9
+                print("Iter %d: remain %5dMB of %5dMB (total %5dMB @ %5dMb/sec)" % (
ae23c9
                     progress._ram._iterations,
ae23c9
                     progress._ram._remaining_bytes / (1024 * 1024),
ae23c9
                     progress._ram._total_bytes / (1024 * 1024),
ae23c9
                     progress._ram._transferred_bytes / (1024 * 1024),
ae23c9
                     progress._ram._transfer_rate_mbs,
ae23c9
-                )
ae23c9
+                ))
ae23c9
 
ae23c9
             if progress._ram._iterations > scenario._max_iters:
ae23c9
                 if self._verbose:
ae23c9
-                    print "No completion after %d iterations over RAM" % scenario._max_iters
ae23c9
+                    print("No completion after %d iterations over RAM" % scenario._max_iters)
ae23c9
                 src.command("migrate_cancel")
ae23c9
                 continue
ae23c9
 
ae23c9
             if time.time() > (start + scenario._max_time):
ae23c9
                 if self._verbose:
ae23c9
-                    print "No completion after %d seconds" % scenario._max_time
ae23c9
+                    print("No completion after %d seconds" % scenario._max_time)
ae23c9
                 src.command("migrate_cancel")
ae23c9
                 continue
ae23c9
 
ae23c9
@@ -251,7 +252,7 @@ class Engine(object):
ae23c9
                 progress._ram._iterations >= scenario._post_copy_iters and
ae23c9
                 not post_copy):
ae23c9
                 if self._verbose:
ae23c9
-                    print "Switching to post-copy after %d iterations" % scenario._post_copy_iters
ae23c9
+                    print("Switching to post-copy after %d iterations" % scenario._post_copy_iters)
ae23c9
                 resp = src.command("migrate-start-postcopy")
ae23c9
                 post_copy = True
ae23c9
 
ae23c9
@@ -259,7 +260,7 @@ class Engine(object):
ae23c9
                 progress._ram._iterations >= scenario._pause_iters and
ae23c9
                 not paused):
ae23c9
                 if self._verbose:
ae23c9
-                    print "Pausing VM after %d iterations" % scenario._pause_iters
ae23c9
+                    print("Pausing VM after %d iterations" % scenario._pause_iters)
ae23c9
                 resp = src.command("stop")
ae23c9
                 paused = True
ae23c9
 
ae23c9
@@ -348,7 +349,7 @@ class Engine(object):
ae23c9
         if not log:
ae23c9
             return []
ae23c9
         if self._debug:
ae23c9
-            print log
ae23c9
+            print(log)
ae23c9
 
ae23c9
         regex = r"[^\s]+\s\((\d+)\):\sINFO:\s(\d+)ms\scopied\s\d+\sGB\sin\s(\d+)ms"
ae23c9
         matcher = re.compile(regex)
ae23c9
@@ -407,7 +408,7 @@ class Engine(object):
ae23c9
             if uri[0:5] == "unix:":
ae23c9
                 os.remove(uri[5:])
ae23c9
             if self._verbose:
ae23c9
-                print "Finished migration"
ae23c9
+                print("Finished migration")
ae23c9
 
ae23c9
             src.shutdown()
ae23c9
             dst.shutdown()
ae23c9
@@ -420,7 +421,7 @@ class Engine(object):
ae23c9
                           self._initrd, self._transport, self._sleep)
ae23c9
         except Exception as e:
ae23c9
             if self._debug:
ae23c9
-                print "Failed: %s" % str(e)
ae23c9
+                print("Failed: %s" % str(e))
ae23c9
             try:
ae23c9
                 src.shutdown()
ae23c9
             except:
ae23c9
@@ -431,7 +432,7 @@ class Engine(object):
ae23c9
                 pass
ae23c9
 
ae23c9
             if self._debug:
ae23c9
-                print src.get_log()
ae23c9
-                print dst.get_log()
ae23c9
+                print(src.get_log())
ae23c9
+                print(dst.get_log())
ae23c9
             raise
ae23c9
 
ae23c9
diff --git a/tests/migration/guestperf/plot.py b/tests/migration/guestperf/plot.py
ae23c9
index bc42249..aa98912 100644
ae23c9
--- a/tests/migration/guestperf/plot.py
ae23c9
+++ b/tests/migration/guestperf/plot.py
ae23c9
@@ -1,3 +1,4 @@
ae23c9
+from __future__ import print_function
ae23c9
 #
ae23c9
 # Migration test graph plotting
ae23c9
 #
ae23c9
@@ -588,7 +589,7 @@ class Plot(object):
ae23c9
 """
ae23c9
 
ae23c9
     def generate_html(self, fh):
ae23c9
-        print >>fh, """<html>
ae23c9
+        print("""<html>
ae23c9
   <head>
ae23c9
     <script type="text/javascript" src="plotly.min.js">
ae23c9
     </script>
ae23c9
@@ -601,19 +602,19 @@ class Plot(object):
ae23c9
     

Migration report

ae23c9
     

Chart summary

ae23c9
     
ae23c9
-""" % self._generate_style()
ae23c9
-        print >>fh, self._generate_chart()
ae23c9
-        print >>fh, """
ae23c9
+""" % self._generate_style(), file=fh)
ae23c9
+        print(self._generate_chart(), file=fh)
ae23c9
+        print("""
ae23c9
     
ae23c9
     

Report details

ae23c9
     
ae23c9
-"""
ae23c9
-        print >>fh, self._generate_report()
ae23c9
-        print >>fh, """
ae23c9
+""", file=fh)
ae23c9
+        print(self._generate_report(), file=fh)
ae23c9
+        print("""
ae23c9
     
ae23c9
   </body>
ae23c9
 </html>
ae23c9
-"""
ae23c9
+""", file=fh)
ae23c9
 
ae23c9
     def generate(self, filename):
ae23c9
         if filename is None:
ae23c9
diff --git a/tests/migration/guestperf/shell.py b/tests/migration/guestperf/shell.py
ae23c9
index b272978..a6b8cec 100644
ae23c9
--- a/tests/migration/guestperf/shell.py
ae23c9
+++ b/tests/migration/guestperf/shell.py
ae23c9
@@ -1,3 +1,4 @@
ae23c9
+from __future__ import print_function
ae23c9
 #
ae23c9
 # Migration test command line shell integration
ae23c9
 #
ae23c9
@@ -160,13 +161,13 @@ class Shell(BaseShell):
ae23c9
         try:
ae23c9
             report = engine.run(hardware, scenario)
ae23c9
             if args.output is None:
ae23c9
-                print report.to_json()
ae23c9
+                print(report.to_json())
ae23c9
             else:
ae23c9
                 with open(args.output, "w") as fh:
ae23c9
-                    print >>fh, report.to_json()
ae23c9
+                    print(report.to_json(), file=fh)
ae23c9
             return 0
ae23c9
         except Exception as e:
ae23c9
-            print >>sys.stderr, "Error: %s" % str(e)
ae23c9
+            print("Error: %s" % str(e), file=sys.stderr)
ae23c9
             if args.debug:
ae23c9
                 raise
ae23c9
             return 1
ae23c9
@@ -199,11 +200,11 @@ class BatchShell(BaseShell):
ae23c9
                     name = os.path.join(comparison._name, scenario._name)
ae23c9
                     if not fnmatch.fnmatch(name, args.filter):
ae23c9
                         if args.verbose:
ae23c9
-                            print "Skipping %s" % name
ae23c9
+                            print("Skipping %s" % name)
ae23c9
                         continue
ae23c9
 
ae23c9
                     if args.verbose:
ae23c9
-                        print "Running %s" % name
ae23c9
+                        print("Running %s" % name)
ae23c9
 
ae23c9
                     dirname = os.path.join(args.output, comparison._name)
ae23c9
                     filename = os.path.join(dirname, scenario._name + ".json")
ae23c9
@@ -211,9 +212,9 @@ class BatchShell(BaseShell):
ae23c9
                         os.makedirs(dirname)
ae23c9
                     report = engine.run(hardware, scenario)
ae23c9
                     with open(filename, "w") as fh:
ae23c9
-                        print >>fh, report.to_json()
ae23c9
+                        print(report.to_json(), file=fh)
ae23c9
         except Exception as e:
ae23c9
-            print >>sys.stderr, "Error: %s" % str(e)
ae23c9
+            print("Error: %s" % str(e), file=sys.stderr)
ae23c9
             if args.debug:
ae23c9
                 raise
ae23c9
 
ae23c9
@@ -246,14 +247,14 @@ class PlotShell(object):
ae23c9
 
ae23c9
 
ae23c9
         if len(args.reports) == 0:
ae23c9
-            print >>sys.stderr, "At least one report required"
ae23c9
+            print("At least one report required", file=sys.stderr)
ae23c9
             return 1
ae23c9
 
ae23c9
         if not (args.qemu_cpu or
ae23c9
                 args.vcpu_cpu or
ae23c9
                 args.total_guest_cpu or
ae23c9
                 args.split_guest_cpu):
ae23c9
-            print >>sys.stderr, "At least one chart type is required"
ae23c9
+            print("At least one chart type is required", file=sys.stderr)
ae23c9
             return 1
ae23c9
 
ae23c9
         reports = []
ae23c9
diff --git a/tests/qemu-iotests/149 b/tests/qemu-iotests/149
ae23c9
index 223cd68..d3ffa25 100755
ae23c9
--- a/tests/qemu-iotests/149
ae23c9
+++ b/tests/qemu-iotests/149
ae23c9
@@ -20,6 +20,7 @@
ae23c9
 # Exercise the QEMU 'luks' block driver to validate interoperability
ae23c9
 # with the Linux dm-crypt + cryptsetup implementation
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import subprocess
ae23c9
 import os
ae23c9
 import os.path
ae23c9
@@ -376,7 +377,7 @@ def test_once(config, qemu_img=False):
ae23c9
     finally:
ae23c9
         iotests.log("# Delete image")
ae23c9
         delete_image(config)
ae23c9
-        print
ae23c9
+        print()
ae23c9
 
ae23c9
 
ae23c9
 # Obviously we only work with the luks image format
ae23c9
diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165
ae23c9
index 2936929..88f62d3 100755
ae23c9
--- a/tests/qemu-iotests/165
ae23c9
+++ b/tests/qemu-iotests/165
ae23c9
@@ -18,6 +18,7 @@
ae23c9
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae23c9
 #
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import os
ae23c9
 import re
ae23c9
 import iotests
ae23c9
@@ -85,7 +86,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
ae23c9
         log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log)
ae23c9
         log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log)
ae23c9
         if log:
ae23c9
-            print log
ae23c9
+            print(log)
ae23c9
 
ae23c9
         self.vm = self.mkVm()
ae23c9
         self.vm.launch()
ae23c9
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
ae23c9
index b25d48a..26e6046 100644
ae23c9
--- a/tests/qemu-iotests/iotests.py
ae23c9
+++ b/tests/qemu-iotests/iotests.py
ae23c9
@@ -1,3 +1,4 @@
ae23c9
+from __future__ import print_function
ae23c9
 # Common utilities and Python wrappers for qemu-iotests
ae23c9
 #
ae23c9
 # Copyright (C) 2012 IBM Corp.
ae23c9
@@ -209,7 +210,7 @@ def filter_qmp_event(event):
ae23c9
 def log(msg, filters=[]):
ae23c9
     for flt in filters:
ae23c9
         msg = flt(msg)
ae23c9
-    print msg
ae23c9
+    print(msg)
ae23c9
 
ae23c9
 class Timeout:
ae23c9
     def __init__(self, seconds, errmsg = "Timeout"):
ae23c9
@@ -525,7 +526,7 @@ def notrun(reason):
ae23c9
     seq = os.path.basename(sys.argv[0])
ae23c9
 
ae23c9
     open('%s/%s.notrun' % (output_dir, seq), 'wb').write(reason + '\n')
ae23c9
-    print '%s not run: %s' % (seq, reason)
ae23c9
+    print('%s not run: %s' % (seq, reason))
ae23c9
     sys.exit(0)
ae23c9
 
ae23c9
 def verify_image_format(supported_fmts=[], unsupported_fmts=[]):
ae23c9
diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py
ae23c9
index 8a04d97..f9193c0 100755
ae23c9
--- a/tests/qemu-iotests/nbd-fault-injector.py
ae23c9
+++ b/tests/qemu-iotests/nbd-fault-injector.py
ae23c9
@@ -43,6 +43,7 @@
ae23c9
 # This work is licensed under the terms of the GNU GPL, version 2 or later.
ae23c9
 # See the COPYING file in the top-level directory.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import socket
ae23c9
 import struct
ae23c9
@@ -110,7 +111,7 @@ class FaultInjectionSocket(object):
ae23c9
         for rule in self.rules:
ae23c9
             if rule.match(event, io):
ae23c9
                 if rule.when == 0 or bufsize is None:
ae23c9
-                    print 'Closing connection on rule match %s' % rule.name
ae23c9
+                    print('Closing connection on rule match %s' % rule.name)
ae23c9
                     sys.exit(0)
ae23c9
                 if rule.when != -1:
ae23c9
                     return rule.when
ae23c9
@@ -182,7 +183,7 @@ def handle_connection(conn, use_export):
ae23c9
         elif req.type == NBD_CMD_DISC:
ae23c9
             break
ae23c9
         else:
ae23c9
-            print 'unrecognized command type %#02x' % req.type
ae23c9
+            print('unrecognized command type %#02x' % req.type)
ae23c9
             break
ae23c9
     conn.close()
ae23c9
 
ae23c9
@@ -242,7 +243,7 @@ def open_socket(path):
ae23c9
         sock = socket.socket(socket.AF_UNIX)
ae23c9
         sock.bind(path)
ae23c9
     sock.listen(0)
ae23c9
-    print 'Listening on %s' % path
ae23c9
+    print('Listening on %s' % path)
ae23c9
     sys.stdout.flush() # another process may be waiting, show message now
ae23c9
     return sock
ae23c9
 
ae23c9
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
ae23c9
index 9cc4cf7..b95a837 100755
ae23c9
--- a/tests/qemu-iotests/qcow2.py
ae23c9
+++ b/tests/qemu-iotests/qcow2.py
ae23c9
@@ -1,5 +1,6 @@
ae23c9
 #!/usr/bin/env python
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import struct
ae23c9
 import string
ae23c9
@@ -129,8 +130,8 @@ class QcowHeader:
ae23c9
 
ae23c9
     def dump(self):
ae23c9
         for f in QcowHeader.fields:
ae23c9
-            print "%-25s" % f[2], f[1] % self.__dict__[f[2]]
ae23c9
-        print ""
ae23c9
+            print("%-25s" % f[2], f[1] % self.__dict__[f[2]])
ae23c9
+        print("")
ae23c9
 
ae23c9
     def dump_extensions(self):
ae23c9
         for ex in self.extensions:
ae23c9
@@ -141,11 +142,11 @@ class QcowHeader:
ae23c9
             else:
ae23c9
                 data = "<binary>"
ae23c9
 
ae23c9
-            print "Header extension:"
ae23c9
-            print "%-25s %#x" % ("magic", ex.magic)
ae23c9
-            print "%-25s %d" % ("length", ex.length)
ae23c9
-            print "%-25s %s" % ("data", data)
ae23c9
-            print ""
ae23c9
+            print("Header extension:")
ae23c9
+            print("%-25s %#x" % ("magic", ex.magic))
ae23c9
+            print("%-25s %d" % ("length", ex.length))
ae23c9
+            print("%-25s %s" % ("data", data))
ae23c9
+            print("")
ae23c9
 
ae23c9
 
ae23c9
 def cmd_dump_header(fd):
ae23c9
@@ -157,12 +158,12 @@ def cmd_set_header(fd, name, value):
ae23c9
     try:
ae23c9
         value = int(value, 0)
ae23c9
     except:
ae23c9
-        print "'%s' is not a valid number" % value
ae23c9
+        print("'%s' is not a valid number" % value)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     fields = (field[2] for field in QcowHeader.fields)
ae23c9
     if not name in fields:
ae23c9
-        print "'%s' is not a known header field" % name
ae23c9
+        print("'%s' is not a known header field" % name)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     h = QcowHeader(fd)
ae23c9
@@ -173,7 +174,7 @@ def cmd_add_header_ext(fd, magic, data):
ae23c9
     try:
ae23c9
         magic = int(magic, 0)
ae23c9
     except:
ae23c9
-        print "'%s' is not a valid magic number" % magic
ae23c9
+        print("'%s' is not a valid magic number" % magic)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     h = QcowHeader(fd)
ae23c9
@@ -188,7 +189,7 @@ def cmd_del_header_ext(fd, magic):
ae23c9
     try:
ae23c9
         magic = int(magic, 0)
ae23c9
     except:
ae23c9
-        print "'%s' is not a valid magic number" % magic
ae23c9
+        print("'%s' is not a valid magic number" % magic)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     h = QcowHeader(fd)
ae23c9
@@ -200,7 +201,7 @@ def cmd_del_header_ext(fd, magic):
ae23c9
             h.extensions.remove(ex)
ae23c9
 
ae23c9
     if not found:
ae23c9
-        print "No such header extension"
ae23c9
+        print("No such header extension")
ae23c9
         return
ae23c9
 
ae23c9
     h.update(fd)
ae23c9
@@ -211,7 +212,7 @@ def cmd_set_feature_bit(fd, group, bit):
ae23c9
         if bit < 0 or bit >= 64:
ae23c9
             raise ValueError
ae23c9
     except:
ae23c9
-        print "'%s' is not a valid bit number in range [0, 64)" % bit
ae23c9
+        print("'%s' is not a valid bit number in range [0, 64)" % bit)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     h = QcowHeader(fd)
ae23c9
@@ -222,7 +223,7 @@ def cmd_set_feature_bit(fd, group, bit):
ae23c9
     elif group == 'autoclear':
ae23c9
         h.autoclear_features |= 1 << bit
ae23c9
     else:
ae23c9
-        print "'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group
ae23c9
+        print("'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group)
ae23c9
         sys.exit(1)
ae23c9
 
ae23c9
     h.update(fd)
ae23c9
@@ -248,16 +249,16 @@ def main(filename, cmd, args):
ae23c9
             else:
ae23c9
                 handler(fd, *args)
ae23c9
                 return
ae23c9
-        print "Unknown command '%s'" % cmd
ae23c9
+        print("Unknown command '%s'" % cmd)
ae23c9
     finally:
ae23c9
         fd.close()
ae23c9
 
ae23c9
 def usage():
ae23c9
-    print "Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0]
ae23c9
-    print ""
ae23c9
-    print "Supported commands:"
ae23c9
+    print("Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0])
ae23c9
+    print("")
ae23c9
+    print("Supported commands:")
ae23c9
     for name, handler, num_args, desc in cmds:
ae23c9
-        print "    %-20s - %s" % (name, desc)
ae23c9
+        print("    %-20s - %s" % (name, desc))
ae23c9
 
ae23c9
 if __name__ == '__main__':
ae23c9
     if len(sys.argv) < 3:
ae23c9
diff --git a/tests/qemu-iotests/qed.py b/tests/qemu-iotests/qed.py
ae23c9
index 748068d..ea469b9 100755
ae23c9
--- a/tests/qemu-iotests/qed.py
ae23c9
+++ b/tests/qemu-iotests/qed.py
ae23c9
@@ -10,6 +10,7 @@
ae23c9
 # This work is licensed under the terms of the GNU GPL, version 2 or later.
ae23c9
 # See the COPYING file in the top-level directory.
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import sys
ae23c9
 import struct
ae23c9
 import random
ae23c9
@@ -108,12 +109,12 @@ def corrupt_table_invalidate(qed, table):
ae23c9
 def cmd_show(qed, *args):
ae23c9
     '''show [header|l1|l2 <offset>]- Show header or l1/l2 tables'''
ae23c9
     if not args or args[0] == 'header':
ae23c9
-        print qed.header
ae23c9
+        print(qed.header)
ae23c9
     elif args[0] == 'l1':
ae23c9
-        print qed.l1_table
ae23c9
+        print(qed.l1_table)
ae23c9
     elif len(args) == 2 and args[0] == 'l2':
ae23c9
         offset = int(args[1])
ae23c9
-        print qed.read_table(offset)
ae23c9
+        print(qed.read_table(offset))
ae23c9
     else:
ae23c9
         err('unrecognized sub-command')
ae23c9
 
ae23c9
@@ -146,7 +147,7 @@ def cmd_invalidate(qed, table_level):
ae23c9
 def cmd_need_check(qed, *args):
ae23c9
     '''need-check [on|off] - Test, set, or clear the QED_F_NEED_CHECK header bit'''
ae23c9
     if not args:
ae23c9
-        print bool(qed.header['features'] & QED_F_NEED_CHECK)
ae23c9
+        print(bool(qed.header['features'] & QED_F_NEED_CHECK))
ae23c9
         return
ae23c9
 
ae23c9
     if args[0] == 'on':
ae23c9
@@ -208,11 +209,11 @@ def cmd_copy_metadata(qed, outfile):
ae23c9
     out.close()
ae23c9
 
ae23c9
 def usage():
ae23c9
-    print 'Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0]
ae23c9
-    print
ae23c9
-    print 'Supported commands:'
ae23c9
+    print('Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0])
ae23c9
+    print()
ae23c9
+    print('Supported commands:')
ae23c9
     for cmd in sorted(x for x in globals() if x.startswith('cmd_')):
ae23c9
-        print globals()[cmd].__doc__
ae23c9
+        print(globals()[cmd].__doc__)
ae23c9
     sys.exit(1)
ae23c9
 
ae23c9
 def main():
ae23c9
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
ae23c9
index 3a2d508..3643117 100755
ae23c9
--- a/tests/vm/basevm.py
ae23c9
+++ b/tests/vm/basevm.py
ae23c9
@@ -11,6 +11,7 @@
ae23c9
 # the COPYING file in the top-level directory.
ae23c9
 #
ae23c9
 
ae23c9
+from __future__ import print_function
ae23c9
 import os
ae23c9
 import sys
ae23c9
 import logging
ae23c9
@@ -222,7 +223,7 @@ def main(vmcls):
ae23c9
     try:
ae23c9
         args, argv = parse_args(vmcls.name)
ae23c9
         if not argv and not args.build_qemu and not args.build_image:
ae23c9
-            print "Nothing to do?"
ae23c9
+            print("Nothing to do?")
ae23c9
             return 1
ae23c9
         logging.basicConfig(level=(logging.DEBUG if args.debug
ae23c9
                                    else logging.WARN))
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9