forked from xapi-project/xen-api
/
fence.ml
30 lines (27 loc) · 1.14 KB
/
fence.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(*
* 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.
*)
(* The world's simplest program which attempts to reboot domain 0 *)
let _ =
if Array.length Sys.argv <> 2 || Sys.argv.(1) <> "yesreally" then begin
Printf.fprintf stderr "Immediately fence this host - use with extreme caution\n";
Printf.fprintf stderr "Usage: %s yesreally\n" Sys.argv.(0);
exit 1
end;
let xc = Xenctrl.interface_open () in
(* Clear both watchdog slots *)
(try ignore(Xenctrl.watchdog xc 1 0l) with _ -> ());
(try ignore(Xenctrl.watchdog xc 2 0l) with _ -> ());
(* set a very short timeout *)
Xenctrl.watchdog xc 0 0l
(* boom? *)