Skip to content

Commit e55b8bf

Browse files
committed
CA-230464: Improve error message when not enough memory for PVS cache (xapi-project#2848)
Signed-off-by: Frederico Mazzone <[email protected]>
1 parent 84d4a78 commit e55b8bf

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ocaml/idl/api_messages.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ let v6_license_server_version_obsolete = addMessage "LICENSE_SERVER_VERSION_OBSO
9696
let pvs_proxy_no_cache_sr_available = addMessage "PVS_PROXY_NO_CACHE_SR_AVAILABLE" 3L (* No cache storage available for pvs site on the host *)
9797
let pvs_proxy_setup_failed = addMessage "PVS_PROXY_SETUP_FAILED" 3L (* Setting up pvs proxy rules or pvs proxy daemon initialisation failed internally *)
9898
let pvs_proxy_no_server_available = addMessage "PVS_PROXY_NO_SERVER_AVAILABLE" 3L (* No pvs server available for pvs site on host *)
99+
let pvs_proxy_sr_out_of_space = addMessage "PVS_PROXY_SR_OUT_OF_SPACE" 3L (* PVS cache storage size exceeds available space on SR *)
99100

100101
(* VMPP message types *)
101102
let vmpp_snapshot_lock_failed = addMessage "VMPP_SNAPSHOT_LOCK_FAILED" 3L (*'The snapshot phase is already executing for this protection policy. Please try again later'*)

ocaml/xapi/pvs_proxy_control.ml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,20 @@ let start_proxy ~__context vif proxy =
249249
| Api_errors.Server_error (code, args) when
250250
code = Api_errors.openvswitch_not_active ->
251251
"Host is not using openvswitch"
252+
| Api_errors.Server_error ("SR_BACKEND_FAILURE_44", _)
253+
| Api_errors.Server_error ("SR_BACKEND_FAILURE_79", _) ->
254+
let proxy_uuid = Db.PVS_proxy.get_uuid ~__context ~self:proxy in
255+
let body = Printf.sprintf
256+
"Unable to setup PVS-proxy %s for VIF %s and PVS-site %s: \
257+
PVS cache size for host %s exceeds SR available space."
258+
proxy_uuid (Db.VIF.get_uuid ~__context ~self:vif)
259+
(Db.PVS_site.get_name_label ~__context ~self:(Db.PVS_proxy.get_site ~__context ~self:proxy))
260+
(Db.Host.get_name_label ~__context ~self:(Helpers.get_localhost ~__context)) in
261+
let (name, priority) = Api_messages.pvs_proxy_sr_out_of_space in
262+
Helpers.call_api_functions ~__context (fun rpc session_id ->
263+
ignore(Client.Client.Message.create
264+
~rpc ~session_id ~name ~priority ~cls:`PVS_proxy ~obj_uuid:proxy_uuid ~body));
265+
"PVS cache size exceeds SR available space"
252266
| _ -> Printf.sprintf "unknown error (%s)" (Printexc.to_string e)
253267
in
254268
State.mark_proxy ~__context site vif proxy State.Failed;

0 commit comments

Comments
 (0)