[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEND] Fix interpretation of stringified 64 bit ints in



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID d21c7908e75c1ea1e063ce16f366dd19a4fdfd4d
# Parent  397cc120ae18e18204c8b2c72d9dd7580c15b081
[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@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py    |   14 +++++++-------
 tools/python/xen/xend/XendConfig.py |   19 ++++++++++++++++++-
 2 files changed, 25 insertions(+), 8 deletions(-)

diff -r 397cc120ae18 -r d21c7908e75c tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Oct 12 12:27:56 2006 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Thu Oct 12 12:30:01 2006 +0100
@@ -208,8 +208,8 @@ class XendAPI:
         
         classes = {
             'Session': (session_required,),
-            'Host': (valid_host, session_required),
-            'Host_CPU': (valid_host_cpu, session_required),
+            'host': (valid_host, session_required),
+            'host_cpu': (valid_host_cpu, session_required),
             'VM': (valid_vm, session_required),
             'VBD': (valid_vbd, session_required),
             'VIF': (valid_vif, session_required)}
@@ -346,19 +346,19 @@ class XendAPI:
     # Xen API: Class Host
     # ----------------------------------------------------------------    
 
-    Host_attr_ro = ['software_version',
+    host_attr_ro = ['software_version',
                     'resident_VMs',
                     'host_CPUs']
     
-    Host_attr_rw = ['name_label',
+    host_attr_rw = ['name_label',
                     'name_description']
 
-    Host_methods = ['disable',
+    host_methods = ['disable',
                     'enable',
                     'reboot',
                     'shutdown']
     
-    Host_funcs = ['get_by_label']
+    host_funcs = ['get_by_label']
 
     # attributes
     def host_get_name_label(self, session, host_ref):
@@ -412,7 +412,7 @@ class XendAPI:
     # Xen API: Class Host_CPU
     # ----------------------------------------------------------------
 
-    Host_CPU_attr_ro = ['host',
+    host_cpu_attr_ro = ['host',
                         'number',
                         'features',
                         'utilisation']
diff -r 397cc120ae18 -r d21c7908e75c tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Oct 12 12:27:56 2006 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Thu Oct 12 12:30:01 2006 +0100
@@ -116,6 +116,20 @@ XENAPI_UNSUPPORTED_IN_LEGACY_CFG = [
     'pci_bus',
     'otherconfig'
     ]
+
+# configuration params that need to be converted to ints
+# since the XMLRPC transport for Xen API does not use
+# 32 bit ints but string representation of 64 bit ints.
+XENAPI_INT_CFG = [
+    'user_version',
+    'vcpus_number',
+    'memory_static_min',
+    'memory_static_max',
+    'memory_dynamic_min',
+    'memory_dynamic_max',
+    'tpm_instance',
+    'tpm_backend',
+]    
 
 ##
 ## Xend Configuration Parameters
@@ -563,7 +577,10 @@ class XendConfig(dict):
 
         for cfgkey, apikey in LEGACY_CFG_TO_XENAPI_CFG.items():
             try:
-                cfg[cfgkey] = xenapi_vm[apikey]
+                if apikey in XENAPI_INT_CFG:
+                    cfg[cfgkey] = int(xenapi_vm[apikey])
+                else:
+                    cfg[cfgkey] = xenapi_vm[apikey]                    
             except KeyError:
                 pass
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.