ia64/xen-unstable

changeset 12120:d21c7908e75c

[XEND] Fix interpretation of stringified 64 bit ints in
XendConfig. Rename Xen API classes, "Host" and "Host_CPU" to their
lowercase equivalent.

Apparent confusion in the docs as to what they should be named.

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Thu Oct 12 12:30:01 2006 +0100 (2006-10-12)
parents 397cc120ae18
children 255925ae4127
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendConfig.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Thu Oct 12 12:27:56 2006 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Thu Oct 12 12:30:01 2006 +0100
     1.3 @@ -208,8 +208,8 @@ class XendAPI:
     1.4          
     1.5          classes = {
     1.6              'Session': (session_required,),
     1.7 -            'Host': (valid_host, session_required),
     1.8 -            'Host_CPU': (valid_host_cpu, session_required),
     1.9 +            'host': (valid_host, session_required),
    1.10 +            'host_cpu': (valid_host_cpu, session_required),
    1.11              'VM': (valid_vm, session_required),
    1.12              'VBD': (valid_vbd, session_required),
    1.13              'VIF': (valid_vif, session_required)}
    1.14 @@ -346,19 +346,19 @@ class XendAPI:
    1.15      # Xen API: Class Host
    1.16      # ----------------------------------------------------------------    
    1.17  
    1.18 -    Host_attr_ro = ['software_version',
    1.19 +    host_attr_ro = ['software_version',
    1.20                      'resident_VMs',
    1.21                      'host_CPUs']
    1.22      
    1.23 -    Host_attr_rw = ['name_label',
    1.24 +    host_attr_rw = ['name_label',
    1.25                      'name_description']
    1.26  
    1.27 -    Host_methods = ['disable',
    1.28 +    host_methods = ['disable',
    1.29                      'enable',
    1.30                      'reboot',
    1.31                      'shutdown']
    1.32      
    1.33 -    Host_funcs = ['get_by_label']
    1.34 +    host_funcs = ['get_by_label']
    1.35  
    1.36      # attributes
    1.37      def host_get_name_label(self, session, host_ref):
    1.38 @@ -412,7 +412,7 @@ class XendAPI:
    1.39      # Xen API: Class Host_CPU
    1.40      # ----------------------------------------------------------------
    1.41  
    1.42 -    Host_CPU_attr_ro = ['host',
    1.43 +    host_cpu_attr_ro = ['host',
    1.44                          'number',
    1.45                          'features',
    1.46                          'utilisation']
     2.1 --- a/tools/python/xen/xend/XendConfig.py	Thu Oct 12 12:27:56 2006 +0100
     2.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Oct 12 12:30:01 2006 +0100
     2.3 @@ -117,6 +117,20 @@ XENAPI_UNSUPPORTED_IN_LEGACY_CFG = [
     2.4      'otherconfig'
     2.5      ]
     2.6  
     2.7 +# configuration params that need to be converted to ints
     2.8 +# since the XMLRPC transport for Xen API does not use
     2.9 +# 32 bit ints but string representation of 64 bit ints.
    2.10 +XENAPI_INT_CFG = [
    2.11 +    'user_version',
    2.12 +    'vcpus_number',
    2.13 +    'memory_static_min',
    2.14 +    'memory_static_max',
    2.15 +    'memory_dynamic_min',
    2.16 +    'memory_dynamic_max',
    2.17 +    'tpm_instance',
    2.18 +    'tpm_backend',
    2.19 +]    
    2.20 +
    2.21  ##
    2.22  ## Xend Configuration Parameters
    2.23  ##
    2.24 @@ -563,7 +577,10 @@ class XendConfig(dict):
    2.25  
    2.26          for cfgkey, apikey in LEGACY_CFG_TO_XENAPI_CFG.items():
    2.27              try:
    2.28 -                cfg[cfgkey] = xenapi_vm[apikey]
    2.29 +                if apikey in XENAPI_INT_CFG:
    2.30 +                    cfg[cfgkey] = int(xenapi_vm[apikey])
    2.31 +                else:
    2.32 +                    cfg[cfgkey] = xenapi_vm[apikey]                    
    2.33              except KeyError:
    2.34                  pass
    2.35