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] add simulator support for SCHEDOP_remote_shutdown

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] add simulator support for SCHEDOP_remote_shutdown
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 4 Feb 2010 22:32:55 +0000
Delivery-date: Thu, 04 Feb 2010 14:25:36 -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 David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1265322653 0
# Node ID e3237e03206eff4bd37a93e681024d277ad1c6c2
# Parent  25ccf85b0d062d9f0c9edf5274b0c7e3b6f7ab02
CA-35920: add hypercall simulator support for SCHEDOP_remote_shutdown.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r 25ccf85b0d06 -r e3237e03206e ocaml/xiu/xiu.ml
--- a/ocaml/xiu/xiu.ml  Thu Feb 04 18:42:33 2010 +0000
+++ b/ocaml/xiu/xiu.ml  Thu Feb 04 22:30:53 2010 +0000
@@ -119,6 +119,11 @@
        | Domctl_unknown of int
 
 type sysctl = Sysctl_getdomaininfolist | Sysctl_physinfo | Sysctl_getcpuinfo | 
Sysctl_unknown of int
+
+type hypcall = Hypcall_domain_shutdown
+
+let hypcall_of_int = function
+  | 1 -> Hypcall_domain_shutdown
 
 let domctl_of_int = function
        | 1  -> Domctl_create | 2 -> Domctl_destroy
@@ -528,6 +533,11 @@
   transfer_to_domain d (-d.tot_mem_kib);
   Hashtbl.remove domains domid
 
+let domain_shutdown domid reason = 
+  let d = domain_find domid in
+  d.state <- Shutdown reason;
+  0
+
 let domain_sethandle domid uuid =
        let dom = domain_find domid in dom.uuid <- uuid; ()
 
@@ -597,7 +607,19 @@
 let int_of_hexstring s = Scanf.sscanf s "%x" (fun a -> a)
 
 let do_xc_cmd fd cmd =
-       let do_xc_domctl _cmd args =
+  let do_hypcall _cmd args = 
+       let cmd = hypcall_of_int (int_of_string _cmd) in
+       match cmd, args with
+       | Hypcall_domain_shutdown, [domid; reason] ->
+                 let domid = int_of_string domid in
+                 let reason = int_of_string reason in
+                 hypercall_debug (sprintf "domain_shutdown %d %d" domid 
reason);
+                 exn_to_errno (fun () -> domain_shutdown domid reason)
+       | _,_ ->
+                 hypercall_debug (sprintf "HYCALL(%s) not implemented or 
invalid number of args ([%s])" _cmd (String.concat ";" args));
+                       -einval
+  in
+  let do_xc_domctl _cmd args =
                let cmd = domctl_of_int (int_of_string _cmd) in
                match cmd, args with
                | Domctl_create, [hvm; hap; handle] ->
@@ -716,6 +738,7 @@
        let ret = match lcmd with
        | "domctl" :: cmd :: args -> do_xc_domctl cmd args
        | "sysctl" :: cmd :: args -> do_xc_sysctl cmd args
+       | "hypcall" :: cmd :: args -> do_hypcall cmd args
        | _                       -> -einval in
        marshall_int fd ret
 
1 file changed, 24 insertions(+), 1 deletion(-)
ocaml/xiu/xiu.ml |   25 ++++++++++++++++++++++++-


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>