aboutsummaryrefslogtreecommitdiff
path: root/scripts/kvm
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2018-06-08 09:29:43 -0300
committerEduardo Habkost <ehabkost@redhat.com>2018-06-08 14:39:24 -0300
commitf03868bd5653265e97b253102d77d83ea85efdea (patch)
treef524a2198bb8492e8502326a112d465892d255b0 /scripts/kvm
parent0d2fa03dae4fbe185a082f361342b1e30aed4582 (diff)
python: futurize -f libfuturize.fixes.fix_print_with_import
Change all Python code to use print as a function. This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f libfuturize.fixes.fix_print_with_import $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Fam Zheng <famz@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-2-ehabkost@redhat.com> [ehabkost: fixup tests/docker/docker.py] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'scripts/kvm')
-rwxr-xr-xscripts/kvm/kvm_flightrecorder21
-rwxr-xr-xscripts/kvm/vmxcap1
2 files changed, 12 insertions, 10 deletions
diff --git a/scripts/kvm/kvm_flightrecorder b/scripts/kvm/kvm_flightrecorder
index 7fb1c2d1a7..54a56745e4 100755
--- a/scripts/kvm/kvm_flightrecorder
+++ b/scripts/kvm/kvm_flightrecorder
@@ -32,6 +32,7 @@
# consuming CPU cycles. No disk I/O is performed since the ring buffer holds a
# fixed-size in-memory trace.
+from __future__ import print_function
import sys
import os
@@ -77,8 +78,8 @@ def tail_trace():
pass
def usage():
- print 'Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0]
- print 'Control the KVM flight recorder tracing.'
+ print('Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0])
+ print('Control the KVM flight recorder tracing.')
sys.exit(0)
def main():
@@ -87,15 +88,15 @@ def main():
cmd = sys.argv[1]
if cmd == '--version':
- print 'kvm_flightrecorder version 1.0'
+ print('kvm_flightrecorder version 1.0')
sys.exit(0)
if not os.path.isdir(tracing_dir):
- print 'Unable to tracing debugfs directory, try:'
- print 'mount -t debugfs none /sys/kernel/debug'
+ print('Unable to tracing debugfs directory, try:')
+ print('mount -t debugfs none /sys/kernel/debug')
sys.exit(1)
if not os.access(tracing_dir, os.W_OK):
- print 'Unable to write to tracing debugfs directory, please run as root'
+ print('Unable to write to tracing debugfs directory, please run as root')
sys.exit(1)
if cmd == 'start':
@@ -105,16 +106,16 @@ def main():
try:
buffer_size_kb = int(sys.argv[2])
except ValueError:
- print 'Invalid per-cpu trace buffer size in KB'
+ print('Invalid per-cpu trace buffer size in KB')
sys.exit(1)
write_file(trace_path('buffer_size_kb'), str(buffer_size_kb))
- print 'Per-CPU ring buffer size set to %d KB' % buffer_size_kb
+ print('Per-CPU ring buffer size set to %d KB' % buffer_size_kb)
start_tracing()
- print 'KVM flight recorder enabled'
+ print('KVM flight recorder enabled')
elif cmd == 'stop':
stop_tracing()
- print 'KVM flight recorder disabled'
+ print('KVM flight recorder disabled')
elif cmd == 'dump':
dump_trace()
elif cmd == 'tail':
diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap
index d9a6db0bb7..99a8146aaa 100755
--- a/scripts/kvm/vmxcap
+++ b/scripts/kvm/vmxcap
@@ -10,6 +10,7 @@
# This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level directory.
+from __future__ import print_function
MSR_IA32_VMX_BASIC = 0x480
MSR_IA32_VMX_PINBASED_CTLS = 0x481
MSR_IA32_VMX_PROCBASED_CTLS = 0x482