diff --git a/app/models/container_project.rb b/app/models/container_project.rb index c6f826296fb..ab7256c8868 100644 --- a/app/models/container_project.rb +++ b/app/models/container_project.rb @@ -19,6 +19,7 @@ class ContainerProject < ApplicationRecord has_many :container_builds has_many :container_templates has_many :archived_container_groups, :foreign_key => "old_container_project_id", :class_name => "ContainerGroup" + has_many :persistent_volume_claims # Needed for metrics has_many :metrics, :as => :resource diff --git a/app/models/ems_refresh/save_inventory_container.rb b/app/models/ems_refresh/save_inventory_container.rb index 2e3008a6a30..53d9fb86125 100644 --- a/app/models/ems_refresh/save_inventory_container.rb +++ b/app/models/ems_refresh/save_inventory_container.rb @@ -42,6 +42,9 @@ def save_persistent_volume_claims_inventory(ems, hashes) return if hashes.nil? ems.persistent_volume_claims.reset + hashes.each do |h| + h[:container_project_id] = h.delete_path(:project)[:id] + end save_inventory_multi(ems.persistent_volume_claims, hashes, :use_association, [:ems_ref], [], [:namespace]) diff --git a/app/models/persistent_volume_claim.rb b/app/models/persistent_volume_claim.rb index 6f985b7cbe2..a4a4f3496fe 100644 --- a/app/models/persistent_volume_claim.rb +++ b/app/models/persistent_volume_claim.rb @@ -1,5 +1,6 @@ class PersistentVolumeClaim < ApplicationRecord belongs_to :ext_management_system, :foreign_key => "ems_id" + belongs_to :container_project has_many :container_volumes serialize :capacity, Hash