Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ocaml/xapi/message_forwarding.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2501,6 +2501,8 @@ functor
let snapshot = Db.VM.get_record ~__context ~self:vm in
reserve_memory_for_vm ~__context ~vm ~host ~snapshot
~host_op:`vm_migrate (fun () ->
if Db.VM.get_VGPUs ~__context ~self:vm <> [] then
Xapi_stats.incr_pool_vgpu_migration_count () ;
forward_vm_op ~local_fn ~__context ~vm ~remote_fn
)
) ;
Expand Down Expand Up @@ -2622,6 +2624,8 @@ functor
assert_can_migrate ~__context ~vm ~dest ~live ~vdi_map
~vif_map ~vgpu_map ~options
) ;
if vgpu_map <> [] then
Xapi_stats.incr_pool_vgpu_migration_count () ;
forward_migrate_send ()
)
in
Expand Down
22 changes: 21 additions & 1 deletion ocaml/xapi/xapi_stats.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ module D = Debug.Make (struct let name = "xapi_stats" end)

let with_lock = Xapi_stdext_threads.Threadext.Mutex.execute

let pool_vgpu_migration_count : int Atomic.t = Atomic.make 0

let incr_pool_vgpu_migration_count () = Atomic.incr pool_vgpu_migration_count

let generate_master_stats ~__context =
let session_count =
Db.Session.get_all ~__context |> List.length |> Int64.of_int
Expand Down Expand Up @@ -44,7 +48,23 @@ let generate_master_stats ~__context =
~min:0.0 ~units:"sessions/s" ()
)
in
[session_count_ds; task_count_ds; session_count_change_ds]
let vgpu_migration_count =
Atomic.exchange pool_vgpu_migration_count 0 |> Int64.of_int
in
let vgpu_migration_count_ds =
( Rrd.Host
, Ds.ds_make ~name:"pool_vgpu_migration_rate"
~description:"Number of vGPU migrations occurred per second"
~value:(Rrd.VT_Int64 vgpu_migration_count) ~ty:Rrd.Absolute
~default:true ~min:0. ~units:"migrations/s" ()
)
in
[
session_count_ds
; task_count_ds
; session_count_change_ds
; vgpu_migration_count_ds
]

let gc_debug = ref true

Expand Down
3 changes: 3 additions & 0 deletions ocaml/xapi/xapi_stats.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ val start : unit -> unit

val stop : unit -> unit
(** Stop the stats reporting thread. *)

val incr_pool_vgpu_migration_count : unit -> unit
(** Increments the pool_vgpu_migration_count by 1 . *)
Loading