# HG changeset patch
# User Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
# Node ID 184884cfaa0b23e07e1abe007071b5898b0b21c2
# Parent bdf3bddc97e771e855a852feb5a6140f4a4ab296
Adds support for the keyword 'all' to the vcpu-pin operation.
Using 'all' in place of a specific vcpu will apply the cpumask
to all vcpus in the domain.
Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
docs/man/xm.pod.1 | 4 +++-
tools/python/xen/xend/XendDomain.py | 17 +++++++++++++----
tools/python/xen/xend/server/SrvDomain.py | 2 +-
tools/python/xen/xm/main.py | 8 ++++++--
4 files changed, 23 insertions(+), 8 deletions(-)
diff -r bdf3bddc97e7 -r 184884cfaa0b docs/man/xm.pod.1
--- a/docs/man/xm.pod.1 Tue Sep 26 08:36:39 2006 +0100
+++ b/docs/man/xm.pod.1 Tue Sep 26 12:17:51 2006 +0100
@@ -393,7 +393,9 @@ specified, VCPU information for all doma
=item B<vcpu-pin> I<domain-id> I<vcpu> I<cpus>
-Pins the the VCPU to only run on the specific CPUs.
+Pins the the VCPU to only run on the specific CPUs. The keyword
+I<all> can be used to apply the I<cpus> list to all VCPUs in the
+domain.
Normally VCPUs can float between available CPUs whenever Xen deems a
different run state is appropriate. Pinning can be used to restrict
diff -r bdf3bddc97e7 -r 184884cfaa0b tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Tue Sep 26 08:36:39 2006 +0100
+++ b/tools/python/xen/xend/XendDomain.py Tue Sep 26 12:17:51 2006 +0100
@@ -487,10 +487,19 @@ class XendDomain:
if not dominfo:
raise XendInvalidDomain(str(domid))
- try:
- return xc.vcpu_setaffinity(dominfo.getDomid(), vcpu, cpumap)
- except Exception, ex:
- raise XendError(str(ex))
+ # if vcpu is keyword 'all', apply the cpumap to all vcpus
+ vcpus = [ vcpu ]
+ if str(vcpu).lower() == "all":
+ vcpus = range(0, int(dominfo.getVCpuCount()))
+
+ # set the same cpumask for all vcpus
+ rc = 0
+ for v in vcpus:
+ try:
+ rc = xc.vcpu_setaffinity(dominfo.getDomid(), int(v), cpumap)
+ except Exception, ex:
+ raise XendError(str(ex))
+ return rc
def domain_cpu_sedf_set(self, domid, period, slice_, latency, extratime,
weight):
diff -r bdf3bddc97e7 -r 184884cfaa0b tools/python/xen/xend/server/SrvDomain.py
--- a/tools/python/xen/xend/server/SrvDomain.py Tue Sep 26 08:36:39 2006 +0100
+++ b/tools/python/xen/xend/server/SrvDomain.py Tue Sep 26 12:17:51 2006 +0100
@@ -97,7 +97,7 @@ class SrvDomain(SrvDir):
def op_pincpu(self, _, req):
fn = FormFn(self.xd.domain_pincpu,
[['dom', 'int'],
- ['vcpu', 'int'],
+ ['vcpu', 'str'],
['cpumap', 'str']])
val = fn(req.args, {'dom': self.dom.domid})
return val
diff -r bdf3bddc97e7 -r 184884cfaa0b tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Tue Sep 26 08:36:39 2006 +0100
+++ b/tools/python/xen/xm/main.py Tue Sep 26 12:17:51 2006 +0100
@@ -759,12 +759,16 @@ def xm_vcpu_pin(args):
for i in range(int(x),int(y)+1):
cpus.append(int(i))
else:
- cpus.append(int(c))
+ # remove this element from the list
+ if c[0] == '^':
+ cpus = [x for x in cpus if x != int(c[1:])]
+ else:
+ cpus.append(int(c))
cpus.sort()
return cpus
dom = args[0]
- vcpu = int(args[1])
+ vcpu = args[1]
cpumap = cpu_make_map(args[2])
server.xend.domain.pincpu(dom, vcpu, cpumap)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|