From 7d6b2ecfac3e7188815bf4d3feb51631c0b3a019 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 12 Dec 2007 09:57:55 +0000 Subject: xend, acm: Extend Xen-API with function to reset the policy This patch extends the Xen-API and the legacy XML-RPC interface with a function to reset the policy on the system (through an update with the default policy). I adapted the code in 'xm resetpolicy' to use this now. This patch also extends libxen and the documentation to reflect the new function. Signed-off-by: Stefan Berger --- tools/libxen/include/xen/api/xen_xspolicy.h | 13 +++++++++++++ tools/libxen/src/xen_xspolicy.c | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'tools/libxen') diff --git a/tools/libxen/include/xen/api/xen_xspolicy.h b/tools/libxen/include/xen/api/xen_xspolicy.h index 3ecdc4b54d..b0808f4d57 100644 --- a/tools/libxen/include/xen/api/xen_xspolicy.h +++ b/tools/libxen/include/xen/api/xen_xspolicy.h @@ -240,6 +240,19 @@ xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result, bool overwrite); + +/** + * Attempt to reset the system's policy to the DEFAULT policy for the + * respective policy type. This is done by updating the system and therefore + * underlies the same restrictions of a policy update. This operation may + * for example fail if other domains than Domain-0 are running and have + * different labels than Domain-0. + */ +bool +xen_xspolicy_reset_xspolicy(xen_session *session, xen_xs_policystate **result, + xs_type type); + + /** * Remove any policy from having the system booted with. */ diff --git a/tools/libxen/src/xen_xspolicy.c b/tools/libxen/src/xen_xspolicy.c index ccafe1f4e8..e5f290c1a1 100644 --- a/tools/libxen/src/xen_xspolicy.c +++ b/tools/libxen/src/xen_xspolicy.c @@ -224,6 +224,24 @@ xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result, } +bool +xen_xspolicy_reset_xspolicy(xen_session *session, xen_xs_policystate **result, + xs_type type) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_int, + .u.int_val = type }, + }; + + abstract_type result_type = xen_xs_policystate_abstract_type_; + + *result = NULL; + XEN_CALL_("XSPolicy.reset_xspolicy"); + return session->ok; +} + + bool xen_xspolicy_get_xspolicy(xen_session *session, xen_xs_policystate **result) { -- cgit v1.2.3