Skip to content

Commit

Permalink
B OpenNebula#5041: Avoid gathering KVM I/O statistics for saving VMs (O…
Browse files Browse the repository at this point in the history
…penNebula#160)

Note: Branch 5.12 didn't really suffer from the similar problem in 5.10,
as here "saving" reason is considered as UNKNOWN state for which we
don't collect the I/O statistics. This change only aligns with previous
behaviour to consider "saving" as RUNNING state, and explicitly lists
few RUNNING reasons (including new "saving") to skip monitoring for.

It's more a polishment, than a real bugfix.
  • Loading branch information
Vlastimil Holer authored Aug 20, 2020
1 parent fb0d1bb commit 5b25744
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/im_mad/remotes/lib/kvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def to_one
'pmsuspended' => 'SUSPENDED',
'paused' => {
'migrating' => 'RUNNING',
'saving' => 'RUNNING',
'starting up' => 'RUNNING',
'booted' => 'RUNNING',
'I/O error' => 'FAILURE',
Expand All @@ -272,6 +273,9 @@ def to_one
}
}

# List of domain state reasons (for RUNNING) when to skip I/O monitoring
REASONS_SKIP_IO = ['migrating', 'starting up', 'saving']

# Get the I/O stats of the domain as provided by Libvirt command domstats
# The metrics are aggregated for all DIKS and NIC
def io_stats
Expand All @@ -282,7 +286,8 @@ def io_stats
@vm[:diskrdiops] = 0
@vm[:diskwriops] = 0

return if @vm[:state] != 'RUNNING' || @vm[:reason] == 'migrating'
return if @vm[:state] != 'RUNNING' ||
REASONS_SKIP_IO.include?(@vm[:reason])

vm_stats, _e, s = KVM.virsh(:domstats, @name)

Expand Down

0 comments on commit 5b25744

Please sign in to comment.