Skip to content

Commit

Permalink
Merge pull request ManageIQ#18159 from yaacov/wip-add-aggregate_memor…
Browse files Browse the repository at this point in the history
…y-to-container-project

Add aggregate_memory to container project

(cherry picked from commit edd65ff)

https://bugzilla.redhat.com/show_bug.cgi?id=1647056
  • Loading branch information
agrare authored and nabeel-tariq committed Nov 14, 2018
1 parent 96fddd5 commit 48d249c
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 @@ -22,6 +22,7 @@ class ContainerProject < ApplicationRecord
has_many :container_templates
has_many :archived_container_groups, :foreign_key => "old_container_project_id", :class_name => "ContainerGroup"
has_many :persistent_volume_claims
has_many :computer_systems, :through => :container_nodes

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

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

PERF_ROLLUP_CHILDREN = :all_container_groups

Expand All @@ -63,6 +65,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 48d249c

Please sign in to comment.