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

[Xen-changelog] [xen-unstable] 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.



# HG changeset patch
# User jfehlig@xxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID 54eee6fabbeebf39cfc62972cf9789dbbb6d5f6c
# Parent  c2fe2635e68bfc545e0fbb612a78ed9e957d7d7f
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@xxxxxxxxxx>
---
 tools/libxen/include/xen_internal.h |    1 -
 tools/libxen/src/xen_vm.c           |    2 --
 tools/python/xen/xend/XendAPI.py    |    2 +-
 3 files changed, 1 insertion(+), 4 deletions(-)

diff -r c2fe2635e68b -r 54eee6fabbee tools/libxen/include/xen_internal.h
--- a/tools/libxen/include/xen_internal.h       Fri Dec 15 09:52:19 2006 +0000
+++ b/tools/libxen/include/xen_internal.h       Wed Dec 13 18:06:48 2006 -0700
@@ -128,7 +128,6 @@ xen_enum_lookup_(xen_session *session, c
     xen_enum_lookup_(session__, str__, lookup_table__,  \
                      sizeof(lookup_table__) /           \
                      sizeof(lookup_table__[0]))         \
-                                                        \
 
 #define XEN_ALLOC(type__)                       \
 type__ *                                        \
diff -r c2fe2635e68b -r 54eee6fabbee tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Fri Dec 15 09:52:19 2006 +0000
+++ b/tools/libxen/src/xen_vm.c Wed Dec 13 18:06:48 2006 -0700
@@ -324,9 +324,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;
 }
 
diff -r c2fe2635e68b -r 54eee6fabbee tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Dec 15 09:52:19 2006 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Wed Dec 13 18:06:48 2006 -0700
@@ -669,7 +669,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-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®.