I have been unable to execute many of the new Xen API RPCs, such as
host.get_resident_VMs(), host.get_host_CPUs(), etc. I have tracked this
down to some casing issues in class XendAPI. This patch removes the
lower-casing of class attribute names in the initialization method of
XendAPI and fixes any discrepancies between the attribute names and
corresponding method definitions. With this patch I am now able to
execute (via libxen) many of the RPCs that previously did not work.
An alternative approach would be to preserve the lower-casing in XendAPI
initialization method and change all of the attribute names and
corresponding method definitions to lower-case. I can rework the path
if this is the desired approach.
Regards,
Jim
# HG changeset patch
# User jfehlig@xxxxxxxxxxxxxxxxxxxxxxxxx
# Date 1163543801 25200
# Node ID 834714f9e61c474546d1fabf4ce1e580345bd1d2
# Parent 9a341c6ef6ae2ce90ccdcf89718d4365426d9d96
Fix casing of various functions in XendAPI class.
Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxxxx>
diff -r 9a341c6ef6ae -r 834714f9e61c tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py Mon Nov 13 14:25:48 2006 +0000
+++ b/tools/python/xen/xend/XendAPI.py Tue Nov 14 15:36:41 2006 -0700
@@ -323,7 +323,7 @@ class XendAPI:
# wrap validators around readable class attributes
for attr_name in ro_attrs + rw_attrs + self.Base_attr_ro:
- getter_name = '%s_get_%s' % (cls.lower(), attr_name.lower())
+ getter_name = '%s_get_%s' % (cls.lower(), attr_name)
try:
getter = getattr(XendAPI, getter_name)
for validator in validators:
@@ -336,7 +336,7 @@ class XendAPI:
# wrap validators around writable class attrributes
for attr_name in rw_attrs + self.Base_attr_rw:
- setter_name = '%s_set_%s' % (cls.lower(), attr_name.lower())
+ setter_name = '%s_set_%s' % (cls.lower(), attr_name)
try:
setter = getattr(XendAPI, setter_name)
for validator in validators:
@@ -349,7 +349,7 @@ class XendAPI:
# wrap validators around methods
for method_name in methods + self.Base_methods:
- method_full_name = '%s_%s' % (cls.lower(),method_name.lower())
+ method_full_name = '%s_%s' % (cls.lower(), method_name)
try:
method = getattr(XendAPI, method_full_name)
for validator in validators:
@@ -362,7 +362,7 @@ class XendAPI:
# wrap validators around class functions
for func_name in funcs + self.Base_funcs:
- func_full_name = '%s_%s' % (cls.lower(), func_name.lower())
+ func_full_name = '%s_%s' % (cls.lower(), func_name)
try:
method = getattr(XendAPI, func_full_name)
method = session_required(method)
@@ -405,7 +405,7 @@ class XendAPI:
record = {'this_host': XendNode.instance().uuid,
'this_user': auth_manager().get_user(session)}
return xen_api_success(record)
- def session_to_xml(self, session):
+ def session_to_XML(self, session):
return xen_api_todo()
# attributes (ro)
@@ -529,7 +529,7 @@ class XendAPI:
'features': node.get_host_cpu_features(host_cpu_ref),
'utilisation': node.get_host_cpu_load(host_cpu_ref)}
return xen_api_success(record)
- def host_cpu_to_xml(self, session, host_cpu_ref):
+ def host_cpu_to_XML(self, session, host_cpu_ref):
return xen_api_todo()
# class methods
@@ -579,7 +579,7 @@ class XendAPI:
'VCPUs_policy',
'VCPUs_params',
'VCPUs_features_force_on',
- 'VCPUS_features_force_off',
+ 'VCPUs_features_force_off',
'actions_after_shutdown',
'actions_after_reboot',
'actions_after_suspend',
@@ -835,19 +835,19 @@ class XendAPI:
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_success_void()
- def vm_set_vcpus_policy(self, session, vm_ref):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_success_void()
-
- def vm_set_vcpus_params(self, session, vm_ref):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_success_void()
-
- def vm_set_vcpus_features_force_on(self, session, vm_ref):
- dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
- return xen_api_success_void()
-
- def vm_set_vcpus_features_force_off(self, session, vm_ref):
+ def vm_set_VCPUs_policy(self, session, vm_ref):
+ dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+ return xen_api_success_void()
+
+ def vm_set_VCPUs_params(self, session, vm_ref):
+ dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+ return xen_api_success_void()
+
+ def vm_set_VCPUs_features_force_on(self, session, vm_ref):
+ dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+ return xen_api_success_void()
+
+ def vm_set_VCPUs_features_force_off(self, session, vm_ref):
dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
return xen_api_success_void()
@@ -937,7 +937,7 @@ class XendAPI:
return xen_api_success(domuuid)
# object methods
- def vm_to_xml(self, session, vm_ref):
+ def vm_to_XML(self, session, vm_ref):
return xen_api_todo()
def vm_get_record(self, session, vm_ref):
@@ -1078,11 +1078,11 @@ class XendAPI:
return xen_api_success(vbd_ref)
# attributes (rw)
- def vbd_get_vm(self, session, vbd_ref):
+ def vbd_get_VM(self, session, vbd_ref):
xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property('vbd', vbd_ref, 'VM'))
- def vbd_get_vdi(self, session, vbd_ref):
+ def vbd_get_VDI(self, session, vbd_ref):
return xen_api_todo()
def vbd_get_device(self, session, vbd_ref):
@@ -1204,7 +1204,7 @@ class XendAPI:
image = sr.xen_api_get_by_uuid(vdi_ref)
return xen_api_success(image.name_description)
- def vdi_get_sr(self, session, vdi_ref):
+ def vdi_get_SR(self, session, vdi_ref):
sr = XendNode.instance().get_sr()
return xen_api_success(sr.uuid)
@@ -1235,7 +1235,7 @@ class XendAPI:
image.name_description = value
return xen_api_success_void()
- def vdi_set_sr(self, session, vdi_ref, value):
+ def vdi_set_SR(self, session, vdi_ref, value):
return xen_api_error(XEND_ERROR_UNSUPPORTED)
def vdi_set_virtual_size(self, session, vdi_ref, value):
@@ -1255,7 +1255,7 @@ class XendAPI:
sr.destroy_image(vdi_ref)
return xen_api_success_void()
- def vdi_to_xml(self, session, vdi_ref):
+ def vdi_to_XML(self, session, vdi_ref):
return xen_api_todo()
def vdi_get_record(self, session, vdi_ref):
@@ -1434,7 +1434,7 @@ class XendAPI:
def sr_destroy(self, session, sr_ref):
return xen_api_error(XEND_ERROR_UNSUPPORTED)
- def sr_to_xml(self, session, sr_ref):
+ def sr_to_XML(self, session, sr_ref):
return xen_api_todo()
def sr_get_record(self, session, sr_ref):
@@ -1452,7 +1452,7 @@ class XendAPI:
})
# Attribute acceess
- def sr_get_vdis(self, session, sr_ref):
+ def sr_get_VDIs(self, session, sr_ref):
sr = XendNode.instance().get_sr()
return xen_api_success(sr.list_images())
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|