ia64/xen-unstable

changeset 13056:54eee6fabbee

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.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author jfehlig@jfehlig2.provo.novell.com
date Wed Dec 13 18:06:48 2006 -0700 (2006-12-13)
parents c2fe2635e68b
children 671cc928183d
files tools/libxen/include/xen_internal.h tools/libxen/src/xen_vm.c tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/tools/libxen/include/xen_internal.h	Fri Dec 15 09:52:19 2006 +0000
     1.2 +++ b/tools/libxen/include/xen_internal.h	Wed Dec 13 18:06:48 2006 -0700
     1.3 @@ -128,7 +128,6 @@ xen_enum_lookup_(xen_session *session, c
     1.4      xen_enum_lookup_(session__, str__, lookup_table__,  \
     1.5                       sizeof(lookup_table__) /           \
     1.6                       sizeof(lookup_table__[0]))         \
     1.7 -                                                        \
     1.8  
     1.9  #define XEN_ALLOC(type__)                       \
    1.10  type__ *                                        \
     2.1 --- a/tools/libxen/src/xen_vm.c	Fri Dec 15 09:52:19 2006 +0000
     2.2 +++ b/tools/libxen/src/xen_vm.c	Wed Dec 13 18:06:48 2006 -0700
     2.3 @@ -324,9 +324,7 @@ xen_vm_get_power_state(xen_session *sess
     2.4          };
     2.5  
     2.6      abstract_type result_type = xen_vm_power_state_abstract_type_;
     2.7 -    char *result_str = NULL;
     2.8      XEN_CALL_("VM.get_power_state");
     2.9 -    *result = xen_vm_power_state_from_string(session, result_str);
    2.10      return session->ok;
    2.11  }
    2.12  
     3.1 --- a/tools/python/xen/xend/XendAPI.py	Fri Dec 15 09:52:19 2006 +0000
     3.2 +++ b/tools/python/xen/xend/XendAPI.py	Wed Dec 13 18:06:48 2006 -0700
     3.3 @@ -669,7 +669,7 @@ class XendAPI:
     3.4      # attributes (ro)
     3.5      def VM_get_power_state(self, session, vm_ref):
     3.6          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
     3.7 -        return xen_api_success(dom.state)
     3.8 +        return xen_api_success(dom.get_power_state())
     3.9      
    3.10      def VM_get_resident_on(self, session, vm_ref):
    3.11          return xen_api_success(XendNode.instance().uuid)