mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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@us.ibm.com>
This commit is contained in:
1 parent
2d5c2b773d
commit
7ccdaed2ed
4 files changed
+23
-8
No files matched your search
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||