File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -2501,6 +2501,8 @@ functor
2501
2501
let snapshot = Db.VM. get_record ~__context ~self: vm in
2502
2502
reserve_memory_for_vm ~__context ~vm ~host ~snapshot
2503
2503
~host_op: `vm_migrate (fun () ->
2504
+ if Db.VM. get_VGPUs ~__context ~self: vm <> [] then
2505
+ Xapi_stats. incr_pool_vgpu_migration_count () ;
2504
2506
forward_vm_op ~local_fn ~__context ~vm ~remote_fn
2505
2507
)
2506
2508
) ;
@@ -2622,6 +2624,8 @@ functor
2622
2624
assert_can_migrate ~__context ~vm ~dest ~live ~vdi_map
2623
2625
~vif_map ~vgpu_map ~options
2624
2626
) ;
2627
+ if vgpu_map <> [] then
2628
+ Xapi_stats. incr_pool_vgpu_migration_count () ;
2625
2629
forward_migrate_send ()
2626
2630
)
2627
2631
in
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ module D = Debug.Make (struct let name = "xapi_stats" end)
16
16
17
17
let with_lock = Xapi_stdext_threads.Threadext.Mutex. execute
18
18
19
+ let pool_vgpu_migration_count : int Atomic.t = Atomic. make 0
20
+
21
+ let incr_pool_vgpu_migration_count () = Atomic. incr pool_vgpu_migration_count
22
+
19
23
let generate_master_stats ~__context =
20
24
let session_count =
21
25
Db.Session. get_all ~__context |> List. length |> Int64. of_int
@@ -44,7 +48,23 @@ let generate_master_stats ~__context =
44
48
~min: 0.0 ~units: " sessions/s" ()
45
49
)
46
50
in
47
- [session_count_ds; task_count_ds; session_count_change_ds]
51
+ let vgpu_migration_count =
52
+ Atomic. exchange pool_vgpu_migration_count 0 |> Int64. of_int
53
+ in
54
+ let vgpu_migration_count_ds =
55
+ ( Rrd. Host
56
+ , Ds. ds_make ~name: " pool_vgpu_migration_rate"
57
+ ~description: " Number of vGPU migrations occurred per second"
58
+ ~value: (Rrd. VT_Int64 vgpu_migration_count) ~ty: Rrd. Absolute
59
+ ~default: true ~min: 0. ~units: " migrations/s" ()
60
+ )
61
+ in
62
+ [
63
+ session_count_ds
64
+ ; task_count_ds
65
+ ; session_count_change_ds
66
+ ; vgpu_migration_count_ds
67
+ ]
48
68
49
69
let gc_debug = ref true
50
70
Original file line number Diff line number Diff line change @@ -18,3 +18,6 @@ val start : unit -> unit
18
18
19
19
val stop : unit -> unit
20
20
(* * Stop the stats reporting thread. *)
21
+
22
+ val incr_pool_vgpu_migration_count : unit -> unit
23
+ (* * Increments the pool_vgpu_migration_count by 1 . *)
You can’t perform that action at this time.
0 commit comments