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

[Xen-API] [PATCH] CP-1625: Xapi interface to xen-cmdline script


  • To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
  • From: Rob Hoes <rob.hoes@xxxxxxxxxx>
  • Date: Tue, 16 Feb 2010 23:11:18 +0000
  • Delivery-date: Tue, 16 Feb 2010 15:11:49 -0800
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
CP-1625: Xapi interface to xen-cmdline script

This interface is used to view, set and remove the CPU feature masks applied by 
Xen in the next boot.

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>

diff -r c1e01ad7272e ocaml/xapi/OMakefile
--- a/ocaml/xapi/OMakefile      Tue Feb 16 10:53:29 2010 +0000
+++ b/ocaml/xapi/OMakefile      Tue Feb 16 21:41:09 2010 +0000
@@ -231,7 +231,8 @@
        ../license/v6client \
        bios_strings \
        xapi_config \
-       ../license/grace_retry
+       ../license/grace_retry \
+       xen_cmdline
 
 OCamlProgram(xapi, $(XAPI_MODULES))
 OCamlDocProgram(xapi, $(XAPI_MODULES))
diff -r c1e01ad7272e ocaml/xapi/xen_cmdline.ml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/ocaml/xapi/xen_cmdline.ml Tue Feb 16 21:41:09 2010 +0000
@@ -0,0 +1,32 @@
+(*
+ * Copyright (C) 2006-2009 Citrix Systems Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+let xen_cmdline_script = "/opt/xensource/libexec/xen-cmdline"
+
+let call_script args = 
+       try
+               let out, _ = Forkhelpers.execute_command_get_output 
xen_cmdline_script args in
+               out
+       with 
+       | Forkhelpers.Spawn_internal_error(stderr, stdout, Unix.WEXITED n) ->
+               failwith "Error while calling xen-cmdline script"
+               
+let list_cpuid_masks () =
+       call_script ["--list-cpuid-masks"]
+
+let set_cpuid_masks masks =
+       call_script ("--set-cpuid-masks" :: (List.map (fun (k,v) -> k ^ "=" ^ 
v) masks))
+       
+let delete_cpuid_masks masks =
+       List.map (fun mask -> call_script ("--delete-cpuid-masks" :: [mask])) 
masks

Attachment: xen-cmdline
Description: Text document

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.