Skip to content

Commit

Permalink
CP-49446: Update SR health to include new constructors
Browse files Browse the repository at this point in the history
Currently, the storage layer tracks two extra SR health statuses that XAPI is
unaware of. These are "unreachable" and "unavailable". At present, the storage
side simply maps these to "recovering" when sending information to the
toolstack. This change will allow the storage layer to track more accurate SR
health statuses.

Signed-off-by: Colin James <[email protected]>
  • Loading branch information
contificate authored May 31, 2024
1 parent 7a14d45 commit 5ec4c26
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
11 changes: 10 additions & 1 deletion ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2791,12 +2791,21 @@ module Sr_stat = struct
, [
("healthy", "Storage is fully available")
; ("recovering", "Storage is busy recovering, e.g. rebuilding mirrors.")
; ("unreachable", "Storage is unreachable")
; ("unavailable", "Storage is unavailable")
]
)

let t =
let lifecycle =
[(Prototyped, rel_kolkata, ""); (Published, rel_lima, "")]
[
(Prototyped, rel_kolkata, "")
; (Published, rel_lima, "")
; ( Extended
, "24.16.0"
, "Enum extended with 'unreachable' and 'unavailable' values"
)
]
in
create_obj ~in_db:false ~persist:PersistNothing
~gen_constructor_destructor:false ~lifecycle ~in_oss_since:None
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open Datamodel_roles
to leave a gap for potential hotfixes needing to increment the schema version.*)
let schema_major_vsn = 5

let schema_minor_vsn = 776
let schema_minor_vsn = 778

(* Historical schema versions just in case this is useful later *)
let rio_schema_major_vsn = 5
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/schematest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let hash x = Digest.string x |> Digest.to_hex
(* BEWARE: if this changes, check that schema has been bumped accordingly in
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)

let last_known_schema_hash = "2b8b5b107eb465e97d35a68274ac18ef"
let last_known_schema_hash = "b24c445c4f9c3e7f63caf45705865fc8"

let current_schema_hash : string =
let open Datamodel_types in
Expand Down
4 changes: 4 additions & 0 deletions ocaml/xapi-cli-server/cli_operations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2566,6 +2566,10 @@ let sr_probe_ext printer rpc session_id params =
"healthy"
| `recovering ->
"recovering"
| `unreachable ->
"unreachable"
| `unavailable ->
"unavailable"
in
(match x.API.sr_stat_uuid with Some uuid -> [("uuid", uuid)] | None -> [])
@ [
Expand Down
3 changes: 2 additions & 1 deletion ocaml/xapi-idl/storage/storage_interface.ml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ let default_vdi_info =
| Error (`Msg m) ->
failwith (Printf.sprintf "Error creating default_vdi_info: %s" m)

type sr_health = Healthy | Recovering [@@deriving rpcty]
type sr_health = Healthy | Recovering | Unreachable | Unavailable
[@@deriving rpcty]

type sr_info = {
sr_uuid: string option
Expand Down
10 changes: 9 additions & 1 deletion ocaml/xapi/xapi_sr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,15 @@ let probe =
let probe_ext =
let to_xenapi_sr_health =
let open Storage_interface in
function Healthy -> `healthy | Recovering -> `recovering
function
| Healthy ->
`healthy
| Recovering ->
`recovering
| Unreachable ->
`unreachable
| Unavailable ->
`unavailable
in
let to_xenapi_sr_stat
Storage_interface.
Expand Down

0 comments on commit 5ec4c26

Please sign in to comment.