From: Jim Fehlig <jfehlig@novell.com>
To: Xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] [xend and libxenapi] Fix VM.get_power_state API
Date: Wed, 13 Dec 2006 18:11:43 -0700 [thread overview]
Message-ID: <4580A4CF.4010607@novell.com> (raw)
[-- 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
next reply other threads:[~2006-12-14 1:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-14 1:11 Jim Fehlig [this message]
2006-12-15 10:58 ` [PATCH] [xend and libxenapi] Fix VM.get_power_state API Ewan Mellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4580A4CF.4010607@novell.com \
--to=jfehlig@novell.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.