1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +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.

(cherry picked from commit 5b25744ca373f1c16db1a9a74860227c471173b1)
This commit is contained in:
Vlastimil Holer 2020-08-20 11:25:43 +02:00 committed by Ruben S. Montero
parent 058ab946f2
commit ddb4067fbd
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

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)