Skip to content

Commit b388b40

Browse files
authored
Fix qmp-vcpu-pin.sh for vCPU pinning (MoatLab#81)
Fix qmp-vcpu-pin.sh and make it compatible with python2
1 parent f27b74a commit b388b40

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

femu-scripts/ftk/qmp-vcpu-pin

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python2
22
# QEMU vCPU pinning tool
33
#
44
# Copyright (C) 2016 Red Hat Inc.
@@ -29,9 +29,9 @@ devnull = open(os.devnull, 'w')
2929
srv = QEMUMonitorProtocol(args.server)
3030
srv.connect()
3131

32-
for vcpu in srv.command('query-cpus'):
33-
vcpuid = vcpu['CPU']
34-
tid = vcpu['thread_id']
32+
for vcpu in srv.command('query-cpus-fast'):
33+
vcpuid = vcpu['cpu-index']
34+
tid = vcpu['thread-id']
3535
if tid in pinned:
3636
print 'vCPU{}\'s tid {} already pinned, skipping'.format(vcpuid, tid)
3737
continue
@@ -42,4 +42,4 @@ for vcpu in srv.command('query-cpus'):
4242
call(['taskset', '-pc', str(cpuid), str(tid)], stdout=devnull)
4343
pinned.append(tid)
4444
except OSError:
45-
print 'Failed to pin vCPU{} to CPU{}'.format(vcpuid, cpuid)
45+
print 'Failed to pin vCPU{} to CPU{}'.format(vcpuid, cpuid)

femu-scripts/ftk/qmp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/python2
12
# QEMU Monitor Protocol Python class
23
#
34
# Copyright (C) 2009, 2010 Red Hat Inc.

0 commit comments

Comments
 (0)