Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CA-62302: Add a cli command to declare a host dead

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
  • Loading branch information...
commit 77986d6aaa535a1c4e7a37b38eac870680c178bf 1 parent c8a9425
@jonludlam jonludlam authored
Showing with 14 additions and 2 deletions.
  1. +9 −0 ocaml/xapi/cli_frontend.ml
  2. +5 −2 ocaml/xapi/cli_operations.ml
View
9 ocaml/xapi/cli_frontend.ml
@@ -423,6 +423,15 @@ let rec cmdtable_data : (string*cmd_spec) list =
flags=[];
};
+ "host-declare-dead",
+ {
+ reqd=["uuid"];
+ optn=[];
+ help="Declare that the the host is dead without contacting it explicitly. WARNING: This call is dangerous and can cause data loss if the host is not actually dead";
+ implementation=With_fd Cli_operations.host_declare_dead;
+ flags=[];
+ };
+
"host-disable",
{
reqd=[];
View
7 ocaml/xapi/cli_operations.ml
@@ -2765,7 +2765,7 @@ let vm_cd_insert printer rpc session_id params =
in
ignore(do_vm_op printer rpc session_id op params ["cd-name"])
-let host_forget fd printer rpc session_id params =
+let host_careful_op op fd printer rpc session_id params =
let uuid = List.assoc "uuid" params in
let host = Client.Host.get_by_uuid rpc session_id uuid in
let pool = List.hd (Client.Pool.get_all rpc session_id) in
@@ -2774,7 +2774,7 @@ let host_forget fd printer rpc session_id params =
let force = get_bool_param params "force" in
- let go () = ignore (Client.Host.destroy rpc session_id host) in
+ let go () = ignore (op ~rpc ~session_id ~self:host) in
if force
then go ()
@@ -2788,6 +2788,9 @@ let host_forget fd printer rpc session_id params =
then go ()
end
+let host_forget x = host_careful_op Client.Host.destroy x
+let host_declare_dead x = host_careful_op (fun ~rpc ~session_id ~self -> Client.Host.declare_dead ~rpc ~session_id ~host:self) x
+
let host_license_view printer rpc session_id params =
let host =
if List.mem_assoc "host-uuid" params then

0 comments on commit 77986d6

Please sign in to comment.
Something went wrong with that request. Please try again.