mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
Fix up xm vcpu-pin via XenAPI, change types of new VM Metrics feilds
signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
This commit is contained in:
1 parent
54a101a7dd
commit
17a7dd0661
3 files changed
+9
-9
No files matched your search
@@ -1403,7 +1403,8 @@ class XendAPI(object):
|
||||
if key.startswith("cpumap"):
|
||||
vcpu = int(key[6:])
|
||||
try:
|
||||
xendom.domain_pincpu(xeninfo.getDomid(), vcpu, value)
|
||||
cpus = map(int, value.split(","))
|
||||
xendom.domain_pincpu(xeninfo.getDomid(), vcpu, cpus)
|
||||
except Exception, ex:
|
||||
log.exception(ex)
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class XendVMMetrics:
|
||||
set_flag('blocked')
|
||||
set_flag('online')
|
||||
set_flag('running')
|
||||
vcpus_flags[i] = ",".join(flags)
|
||||
vcpus_flags[i] = flags
|
||||
return vcpus_flags
|
||||
else:
|
||||
return {}
|
||||
@@ -115,7 +115,7 @@ class XendVMMetrics:
|
||||
addState("dying")
|
||||
addState("crashed")
|
||||
addState("shutdown")
|
||||
return ",".join(states)
|
||||
return states
|
||||
except Exception, err:
|
||||
# ignore missing domain
|
||||
log.trace("domain_getinfo(%d) failed, ignoring: %s", domid, str(err))
|
||||
|
||||
@@ -722,7 +722,7 @@ def getDomains(domain_names, state, full = 0):
|
||||
states = ('running', 'blocked', 'paused', 'shutdown',
|
||||
'crashed', 'dying')
|
||||
def state_on_off(state):
|
||||
if dom_metrics['state'].find(state) > -1:
|
||||
if state in dom_metrics['state']:
|
||||
return state[0]
|
||||
else:
|
||||
return "-"
|
||||
@@ -953,12 +953,10 @@ def xm_vcpu_list(args):
|
||||
['name', vm_records[vm_ref]['name_label']],
|
||||
['vcpu_count', vm_records[vm_ref]['VCPUs_max']]]
|
||||
|
||||
|
||||
|
||||
for i in range(int(vm_records[vm_ref]['VCPUs_max'])):
|
||||
def chk_flag(flag):
|
||||
return vm_metrics[vm_ref]['VCPUs_flags'][str(i)] \
|
||||
.find(flag) > -1 and 1 or 0
|
||||
return flag in vm_metrics[vm_ref]['VCPUs_flags'][str(i)] \
|
||||
and 1 or 0
|
||||
|
||||
vcpu_info = ['vcpu',
|
||||
['number',
|
||||
@@ -1261,8 +1259,9 @@ def xm_vcpu_pin(args):
|
||||
cpumap = cpu_make_map(args[2])
|
||||
|
||||
if serverType == SERVER_XEN_API:
|
||||
cpumap = map(str, cpumap)
|
||||
server.xenapi.VM.add_to_VCPUs_params_live(
|
||||
get_single_vm(dom), "cpumap%i" % vcpu, ",".join(cpumap))
|
||||
get_single_vm(dom), "cpumap%i" % int(vcpu), ",".join(cpumap))
|
||||
else:
|
||||
server.xend.domain.pincpu(dom, vcpu, cpumap)
|
||||
|
||||
|
||||