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
  • Loading branch information
agrare authored Nov 5, 2018
2 parents 9ac7cfa + a97887c commit edd65ff
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
@@ -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
@@ -43,6 +44,7 @@ class ContainerProject < ApplicationRecord

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

PERF_ROLLUP_CHILDREN = :all_container_groups

@@ -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}]")

0 comments on commit edd65ff

Please sign in to comment.