Skip to content

Commit

Permalink
Merge pull request #18159 from yaacov/wip-add-aggregate_memory-to-con…
Browse files Browse the repository at this point in the history
…tainer-project

Add aggregate_memory to container project

(cherry picked from commit edd65ff)

https://bugzilla.redhat.com/show_bug.cgi?id=1618536
  • Loading branch information
agrare authored and simaishi committed Nov 5, 2018
1 parent 17a1214 commit 58788a9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/models/container_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ContainerProject < ApplicationRecord
has_many :archived_container_groups, :foreign_key => "old_container_project_id", :class_name => "ContainerGroup"
has_many :persistent_volume_claims
has_many :miq_alert_statuses, :as => :resource, :dependent => :destroy
has_many :computer_systems, :through => :container_nodes

# Needed for metrics
has_many :metrics, :as => :resource
Expand All @@ -43,6 +44,7 @@ class ContainerProject < ApplicationRecord

include EventMixin
include Metric::CiMixin
include AggregationMixin::Methods

PERF_ROLLUP_CHILDREN = :all_container_groups

Expand All @@ -69,6 +71,21 @@ def perf_rollup_parents(interval_name = nil)
[]
end

# required by aggregate_hardware
alias all_computer_system_ids computer_system_ids

def aggregate_memory(targets = nil)
aggregate_hardware(:computer_systems, :memory_mb, targets)
end

def aggregate_cpu_speed(targets = nil)
aggregate_hardware(:computer_systems, :cpu_speed, targets)
end

def aggregate_cpu_total_cores(targets = nil)
aggregate_hardware(:computer_systems, :cpu_total_cores, targets)
end

def disconnect_inv
return if archived?
_log.info("Disconnecting Container Project [#{name}] id [#{id}] from EMS [#{ext_management_system.name}] id [#{ext_management_system.id}]")
Expand Down

0 comments on commit 58788a9

Please sign in to comment.