Skip to content

Commit

Permalink
CA-379112 log details of insufficient SR size
Browse files Browse the repository at this point in the history
We suspect that the size of the SR is zero and later (too late) is
updated to the correct value. Make this more obvious in the logs.

Signed-off-by: Christian Lindig <[email protected]>
  • Loading branch information
Christian Lindig committed Aug 3, 2023
1 parent 2ab003e commit 959ecba
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ocaml/xapi/xha_statefile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ let check_sr_can_host_statefile ~__context ~sr ~cluster_stack =
debug
"no suitable existing statefile found; would have to create a \
fresh one" ;
let free_space =
Int64.sub
(Db.SR.get_physical_size ~__context ~self:sr)
(Db.SR.get_physical_utilisation ~__context ~self:sr)
in
let self = sr in
let size = Db.SR.get_physical_size ~__context ~self in
let utilisation = Db.SR.get_physical_utilisation ~__context ~self in
let free_space = Int64.sub size utilisation in
if free_space < minimum_size then (
info "SR %s has %Ld free space, needed %Ld" (Ref.string_of sr)
free_space minimum_size ;
let sr = Ref.string_of sr in
info "%s: SR %s size=%Ld utilisation=%Ld free=%Ld needed=%Ld"
__FUNCTION__ sr size utilisation free_space minimum_size ;
raise
(Api_errors.Server_error
(Api_errors.sr_source_space_insufficient, [Ref.string_of sr])
(Api_errors.sr_source_space_insufficient, [sr])
)
) else
None
Expand Down

0 comments on commit 959ecba

Please sign in to comment.