All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [xend and libxenapi] Fix VM.get_power_state API
@ 2006-12-14  1:11 Jim Fehlig
  2006-12-15 10:58 ` Ewan Mellor
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Fehlig @ 2006-12-14  1:11 UTC (permalink / raw)
  To: Xen-devel

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vm-power-state.patch --]
[-- Type: text/x-patch; name="vm-power-state.patch", Size: 2317 bytes --]

# HG changeset patch
# User jfehlig@jfehlig2.provo.novell.com
# 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.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>

diff -r 360eb996fa38 -r 42b515caeb78 tools/libxen/include/xen_internal.h
--- a/tools/libxen/include/xen_internal.h	Wed Dec 13 16:13:26 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 360eb996fa38 -r 42b515caeb78 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c	Wed Dec 13 16:13:26 2006 +0000
+++ b/tools/libxen/src/xen_vm.c	Wed Dec 13 18:06:48 2006 -0700
@@ -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;
 }
 
diff -r 360eb996fa38 -r 42b515caeb78 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py	Wed Dec 13 16:13:26 2006 +0000
+++ b/tools/python/xen/xend/XendAPI.py	Wed Dec 13 18:06:48 2006 -0700
@@ -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)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-15 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14  1:11 [PATCH] [xend and libxenapi] Fix VM.get_power_state API Jim Fehlig
2006-12-15 10:58 ` Ewan Mellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.