ia64/xen-unstable

changeset 14577:ddc2f8b061a3

Fix up xm vcpu-pin via XenAPI, change types of new VM Metrics feilds

signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
author Tom Wilkie <tom.wilkie@gmail.com>
date Mon Mar 26 16:48:20 2007 +0100 (2007-03-26)
parents 5a60095a2299
children 70f4d99d1aed
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendVMMetrics.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Mon Mar 26 16:18:16 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Mon Mar 26 16:48:20 2007 +0100
     1.3 @@ -1403,7 +1403,8 @@ class XendAPI(object):
     1.4              if key.startswith("cpumap"):
     1.5                  vcpu = int(key[6:])
     1.6                  try:
     1.7 -                    xendom.domain_pincpu(xeninfo.getDomid(), vcpu, value)
     1.8 +                    cpus = map(int, value.split(","))
     1.9 +                    xendom.domain_pincpu(xeninfo.getDomid(), vcpu, cpus)
    1.10                  except Exception, ex:
    1.11                      log.exception(ex)
    1.12  
     2.1 --- a/tools/python/xen/xend/XendVMMetrics.py	Mon Mar 26 16:18:16 2007 +0100
     2.2 +++ b/tools/python/xen/xend/XendVMMetrics.py	Mon Mar 26 16:48:20 2007 +0100
     2.3 @@ -92,7 +92,7 @@ class XendVMMetrics:
     2.4                  set_flag('blocked')
     2.5                  set_flag('online')
     2.6                  set_flag('running')
     2.7 -                vcpus_flags[i] = ",".join(flags)
     2.8 +                vcpus_flags[i] = flags
     2.9              return vcpus_flags
    2.10          else:
    2.11              return {}
    2.12 @@ -115,7 +115,7 @@ class XendVMMetrics:
    2.13                  addState("dying")
    2.14                  addState("crashed")
    2.15                  addState("shutdown")
    2.16 -                return ",".join(states)
    2.17 +                return states
    2.18          except Exception, err:
    2.19              # ignore missing domain
    2.20              log.trace("domain_getinfo(%d) failed, ignoring: %s", domid, str(err))
     3.1 --- a/tools/python/xen/xm/main.py	Mon Mar 26 16:18:16 2007 +0100
     3.2 +++ b/tools/python/xen/xm/main.py	Mon Mar 26 16:48:20 2007 +0100
     3.3 @@ -722,7 +722,7 @@ def getDomains(domain_names, state, full
     3.4              states = ('running', 'blocked', 'paused', 'shutdown',
     3.5                        'crashed', 'dying')
     3.6              def state_on_off(state):
     3.7 -                if dom_metrics['state'].find(state) > -1:
     3.8 +                if state in dom_metrics['state']:
     3.9                      return state[0]
    3.10                  else:
    3.11                      return "-"
    3.12 @@ -953,12 +953,10 @@ def xm_vcpu_list(args):
    3.13                      ['name',       vm_records[vm_ref]['name_label']],
    3.14                      ['vcpu_count', vm_records[vm_ref]['VCPUs_max']]]
    3.15  
    3.16 -            
    3.17 -
    3.18              for i in range(int(vm_records[vm_ref]['VCPUs_max'])):
    3.19                  def chk_flag(flag):
    3.20 -                    return vm_metrics[vm_ref]['VCPUs_flags'][str(i)] \
    3.21 -                           .find(flag) > -1 and 1 or 0
    3.22 +                    return flag in vm_metrics[vm_ref]['VCPUs_flags'][str(i)] \
    3.23 +                           and 1 or 0
    3.24                  
    3.25                  vcpu_info = ['vcpu',
    3.26                               ['number',
    3.27 @@ -1261,8 +1259,9 @@ def xm_vcpu_pin(args):
    3.28          cpumap = cpu_make_map(args[2])
    3.29  
    3.30      if serverType == SERVER_XEN_API:
    3.31 +        cpumap = map(str, cpumap)        
    3.32          server.xenapi.VM.add_to_VCPUs_params_live(
    3.33 -            get_single_vm(dom), "cpumap%i" % vcpu, ",".join(cpumap))
    3.34 +            get_single_vm(dom), "cpumap%i" % int(vcpu), ",".join(cpumap))
    3.35      else:
    3.36          server.xend.domain.pincpu(dom, vcpu, cpumap)
    3.37