Fix VM.get_power_state API
PATCH 1/1 Fix VM.get_power_state API
Xend was returning an integer representation of the power state instead of a string representation as specified by the XenAPI spec.
On the c-bindings side, the marshaling code converts the string representation to an enum value. A subsequent attempt to convert the enum from a string to an enum in xen_vm_get_power_state() was causing a seg fault in client application.
This patch fixes the code paths in both xend and c-bindings.
Regards,
Jim
# HG changeset patch
# User [email protected]
# Date 1166058408 25200
# Node ID 42b515caeb78bc9921b1526a9a781724f232aff0
# Parent 360eb996fa38319867a74bf581c734a80bf6839d
Fix VM.get_power_state API. On the xend side an integer representation of the power state was being returned instead of a string representation as specified by the XenAPI spec.
On the c-bindings side the marshalling code converts the string representation to an enum value. A subsequent attempt to convert the enum from a string to an enum was causing a seg fault.
tools/libxen/include/xen_internal.h +0 -1
@@ -128,7 +128,6 @@ xen_enum_lookup_(xen_session *session, cxen_enum_lookup_ (session__, str__, lookup_table__, \sizeof (lookup_table__) / \ sizeof(lookup_table__[0])) \ - \#define XEN_ALLOC (type__) \ type__ * \
tools/libxen/src/xen_vm.c +0 -2
@@ -328,9 +328,7 @@ xen_vm_get_power_state(xen_session *sess };abstract_type result_type = xen_vm_power_state_abstract_type_; -char *result_str =NULL ;XEN_CALL_ ("VM.get_power_state" ); - *result =xen_vm_power_state_from_string (session, result_str);return session->ok; }
tools/python/xen/xend/XendAPI.py +1 -1
@@ -655,7 +655,7 @@ class XendAPI: # attributes (ro) def VM_get_power_state(self, session, vm_ref): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) - return xen_api_success(dom.state) + return xen_api_success(dom.get_power_state()) def VM_get_resident_on(self, session, vm_ref): return xen_api_success(XendNode.instance().uuid)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 20 lines · Jim Fehlig
Xend was returning an integer representation of the power state instead of a string representation as specified by the XenAPI spec.
On the c-bindings side, the marshaling code converts the string representation to an enum value. A subsequent attempt to convert the enum from a string to an enum in
xen_vm_get_power_state()was causing a seg fault in client application.This patch fixes the code paths in both xend and c-bindings.
Regards,
Jim# HG changeset patch
# User [email protected]
# Date 1166058408 25200
# Node ID42b515caeb78bc9921b1526a9a781724f232aff0
# Parent360eb996fa38319867a74bf581c734a80bf6839d
Fix VM.get_power_state API. On the xend side an integer representation of the power state was being returned instead of a string representation as specified by the XenAPI spec.
Quoted 3 lines
On the c-bindings side the marshalling code converts the string representation to an enum value. A subsequent attempt to convert the enum from a string to an enum was causing a seg fault.
Signed-off-by Jim Fehlig <[email protected]>
Applied, thanks Jim. I've added a test for that to the test_bindings program too.
Ewan.