Skip to content

Commit

Permalink
CA-404020: Do not fail when removing a non-existing datasource
Browse files Browse the repository at this point in the history
The latest changes in the metrics daemon changes how archived and live metrics
are synchronised, and archived sources are created less often. This meant that
on some cases, like SR.forget, the operations failed because they could query
for existing sources, but the call to remove them failed, because the metrics
only exist in live form, not archived one.

(what happens with the live one, do they disappear when the SR is forgotten?)

Signed-off-by: Pau Ruiz Safont <[email protected]>
  • Loading branch information
psafont committed Dec 23, 2024
1 parent 9eeb1f3 commit 4394f84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ocaml/libs/xapi-rrd/lib/rrd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,14 @@ let rrd_add_ds rrd timestamp newds =
else
rrd_add_ds_unsafe rrd timestamp newds

(** Remove the named DS from an RRD. Removes all of the data associated with it, too *)
(** Remove the named DS from an RRD. Removes all of the data associated with
it, too. THe function is idempotent. *)
let rrd_remove_ds rrd ds_name =
let n =
Utils.array_index ds_name (Array.map (fun ds -> ds.ds_name) rrd.rrd_dss)
in
if n = -1 then
raise (Invalid_data_source ds_name)
rrd
else
{
rrd with
Expand Down

0 comments on commit 4394f84

Please sign in to comment.