WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] CP-1621: Add CLI commands for viewing and masking CPU

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH] CP-1621: Add CLI commands for viewing and masking CPU features
From: Rob Hoes <rob.hoes@xxxxxxxxxx>
Date: Tue, 16 Feb 2010 23:11:10 +0000
Delivery-date: Tue, 16 Feb 2010 15:11:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
CP-1621: Add CLI commands for viewing and masking CPU features

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

diff -r a7d5d10ec311 ocaml/xapi/cli_frontend.ml
--- a/ocaml/xapi/cli_frontend.ml        Thu Jan 28 16:08:08 2010 +0000
+++ b/ocaml/xapi/cli_frontend.ml        Thu Jan 28 16:38:40 2010 +0000
@@ -687,10 +687,46 @@
    "host-refresh-pack-info",
     {
       reqd=["host-uuid"];
-      optn=[""];
+      optn=[];
       help="Refreshes Host.software_version";
       implementation= No_fd Cli_operations.host_refresh_pack_info;
       flags=[Hidden];
+    };
+
+   "host-cpu-info",
+    {
+      reqd=[];
+      optn=["host-uuid"];
+      help="Lists information about the host's physical CPUs.";
+      implementation= No_fd Cli_operations.host_cpu_info;
+      flags=[];
+    };
+
+   "host-get-cpu-features",
+    {
+      reqd=[];
+      optn=["host-uuid"];
+      help="Prints a hexadecimal representation of the host's physical-CPU 
features.";
+      implementation= No_fd Cli_operations.host_get_cpu_features;
+      flags=[];
+    };
+
+   "host-set-cpu-features",
+    {
+      reqd=["features"];
+      optn=["host-uuid"];
+      help="Attempts to mask the host's physical-CPU features to match the 
given features. The given string must be a 32-digit hexadecimal number 
(optionally containing spaces), as given by host-get-cpu-features.";
+      implementation= No_fd Cli_operations.host_set_cpu_features;
+      flags=[];
+    };
+
+   "host-reset-cpu-features",
+    {
+      reqd=[];
+      optn=["host-uuid"];
+      help="Removes the feature mask of the host's physical CPU (if any).";
+      implementation= No_fd Cli_operations.host_reset_cpu_features;
+      flags=[];
     };
 
    "patch-upload",
diff -r a7d5d10ec311 ocaml/xapi/cli_operations.ml
--- a/ocaml/xapi/cli_operations.ml      Thu Jan 28 16:08:08 2010 +0000
+++ b/ocaml/xapi/cli_operations.ml      Thu Jan 28 16:38:40 2010 +0000
@@ -3527,6 +3527,42 @@
   let host = Client.Host.get_by_uuid rpc session_id host_uuid in
   Client.Host.refresh_pack_info rpc session_id host
 
+let host_cpu_info printer rpc session_id params =
+  let host = 
+    if List.mem_assoc "host-uuid" params then
+      Client.Host.get_by_uuid rpc session_id (List.assoc "host-uuid" params) 
+    else
+      get_host_from_session rpc session_id in
+  let cpu_info = Client.Host.get_cpu_info rpc session_id host in
+  printer (Cli_printer.PTable [cpu_info])
+  
+let host_get_cpu_features printer rpc session_id params =
+  let host = 
+    if List.mem_assoc "host-uuid" params then
+      Client.Host.get_by_uuid rpc session_id (List.assoc "host-uuid" params) 
+    else
+      get_host_from_session rpc session_id in
+  let cpu_info = Client.Host.get_cpu_info rpc session_id host in
+  let features = List.assoc "features" cpu_info in
+  printer (Cli_printer.PMsg features)
+
+let host_set_cpu_features printer rpc session_id params =
+  let host = 
+    if List.mem_assoc "host-uuid" params then
+      Client.Host.get_by_uuid rpc session_id (List.assoc "host-uuid" params) 
+    else
+      get_host_from_session rpc session_id in
+  let features = List.assoc "features" params in
+  Client.Host.set_cpu_features rpc session_id host features
+
+let host_reset_cpu_features printer rpc session_id params =
+  let host = 
+    if List.mem_assoc "host-uuid" params then
+      Client.Host.get_by_uuid rpc session_id (List.assoc "host-uuid" params) 
+    else
+      get_host_from_session rpc session_id in
+  Client.Host.reset_cpu_features rpc session_id host
+    
 let patch_upload fd printer rpc session_id params = 
   let filename = List.assoc "file-name" params in
   let pool = Client.Pool.get_all rpc session_id in

Attachment: flex-cli
Description: Text document

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] CP-1621: Add CLI commands for viewing and masking CPU features, Rob Hoes <=