aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxen
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-12-12 09:57:55 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-12-12 09:57:55 +0000
commit7d6b2ecfac3e7188815bf4d3feb51631c0b3a019 (patch)
tree1ca851a0f919ee68f245db3d4517574698a3a415 /tools/libxen
parentaaa7e11a7cac991f6249d7659ba22e23cfbf1e3e (diff)
downloadxen-7d6b2ecfac3e7188815bf4d3feb51631c0b3a019.tar.gz
xen-7d6b2ecfac3e7188815bf4d3feb51631c0b3a019.tar.bz2
xen-7d6b2ecfac3e7188815bf4d3feb51631c0b3a019.zip
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 <stefanb@us.ibm.com>
Diffstat (limited to 'tools/libxen')
-rw-r--r--tools/libxen/include/xen/api/xen_xspolicy.h13
-rw-r--r--tools/libxen/src/xen_xspolicy.c18
2 files changed, 31 insertions, 0 deletions
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
@@ -225,6 +225,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)
{
abstract_value param_values[] =