From a57bf843bcabc9e85d7e9507a048d88c9cfb1872 Mon Sep 17 00:00:00 2001 From: Christian Lindig Date: Tue, 13 Aug 2024 15:03:05 +0100 Subject: [PATCH] CA-395174: Try to unarchive VM's metrics when they aren't running Backport xen-api.git 71c39605b3a2dd6eddeba42a5b482b4fc1b3a4e8 Non-running VMs' metrics are stored in the coordinator. When the coordinator is asked about the metrics try to unarchive them instead of failing while trying to fetch the coordinator's IP address. This needs to force the HTTP method of the query to be POST Also returns a Service Unavailable when the host is marked as Broken. Signed-off-by: Pau Ruiz Safont Signed-off-by: Christian Lindig --- http-svr/http.ml | 7 +++++++ http-svr/http.mli | 2 ++ 2 files changed, 9 insertions(+) diff --git a/http-svr/http.ml b/http-svr/http.ml index 782ad1d..111681d 100644 --- a/http-svr/http.ml +++ b/http-svr/http.ml @@ -93,6 +93,13 @@ let http_501_method_not_implemented ?(version = "1.0") () = ; "Cache-Control: no-cache, no-store" ] +let http_503_service_unavailable ?(version = "1.0") () = + [ + Printf.sprintf "HTTP/%s 503 Service Unavailable" version + ; "Connection: close" + ; "Cache-Control: no-cache, no-store" + ] + module Hdr = struct let task_id = "task-id" diff --git a/http-svr/http.mli b/http-svr/http.mli index 0babb77..b155539 100644 --- a/http-svr/http.mli +++ b/http-svr/http.mli @@ -194,6 +194,8 @@ val http_500_internal_server_error : ?version:string -> unit -> string list val http_501_method_not_implemented : ?version:string -> unit -> string list +val http_503_service_unavailable : ?version:string -> unit -> string list + module Hdr : sig val task_id : string (** Header used for task id *)