1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #5041: Avoid gathering KVM I/O statistics for saving VMs (#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.
This commit is contained in:
Vlastimil Holer 2020-08-20 11:25:43 +02:00 committed by GitHub
parent fb0d1bb906
commit 5b25744ca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -261,6 +261,7 @@ class Domain < BaseDomain
'pmsuspended' => 'SUSPENDED',
'paused' => {
'migrating' => 'RUNNING',
'saving' => 'RUNNING',
'starting up' => 'RUNNING',
'booted' => 'RUNNING',
'I/O error' => 'FAILURE',
@ -272,6 +273,9 @@ class Domain < BaseDomain
}
}
# 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
@ -282,7 +286,8 @@ class Domain < BaseDomain
@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)