1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-07 17:17:41 +03:00

F #3859: Ignore transient VMs. Fix network_usage

co-authored-by: Daniel Clavijo Coca <dclavijo@opennebula.io>
This commit is contained in:
Ruben S. Montero 2020-06-01 17:53:30 +02:00
parent 6a419e198f
commit c9ff6661b7
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
3 changed files with 12 additions and 5 deletions

View File

@ -77,11 +77,16 @@ module LXD
netrx = 0
nettx = 0
@container.monitor['metadata']['network'].each do |iface, values|
next if iface == 'lo'
begin
@container.monitor['metadata']['network'].each do |iface, values|
next if iface == 'lo'
netrx += values['counters']['bytes_received']
nettx += values['counters']['bytes_sent']
netrx += values['counters']['bytes_received']
nettx += values['counters']['bytes_sent']
end
rescue StandardError
@metrics[:netrx] = 0
@metrics[:nettx] = 0
end
@metrics[:netrx] = netrx

View File

@ -125,6 +125,8 @@ class VirtualMachineDB
monitor_ids << uuid
next if vm[:ignore] == true
if vm_db.nil?
@db.execute(
"INSERT INTO #{@dataset} VALUES (?, ?, ?, ?, ?, ?, ?, ?)",

View File

@ -25,7 +25,7 @@ module DomainList
vm = {}
name = container.name
next if container.config['user.one_status'] == '0'
vm[:ignore] = true if container.config['user.one_status'] == '0'
vm[:name] = name
vm[:uuid] = "#{name}-#{Socket.gethostname}"