diff --git a/app/models/chargeback_rate.rb b/app/models/chargeback_rate.rb index 5daac399054..3818e7397cf 100644 --- a/app/models/chargeback_rate.rb +++ b/app/models/chargeback_rate.rb @@ -28,6 +28,12 @@ class ChargebackRate < ApplicationRecord scope :with_rate_type, ->(rate_type) { where(:rate_type => rate_type) } VALID_CB_RATE_TYPES = ["Compute", "Storage"] + DATASTORE_MAPPING = {'CloudVolume' => 'Storage'}.freeze + + def self.tag_class(klass) + klass = ChargebackRate::DATASTORE_MAPPING[klass] || klass + super(klass) + end def rate_details_relevant_to(report_cols) # we can memoize, as we get the same report_cols thrrough the life of the object diff --git a/app/models/metric/chargeback_helper.rb b/app/models/metric/chargeback_helper.rb index ebcbd58ffdc..1a98800c674 100644 --- a/app/models/metric/chargeback_helper.rb +++ b/app/models/metric/chargeback_helper.rb @@ -32,10 +32,10 @@ def tag_list_with_prefix def resource_parents [parent_host || resource.try(:host), parent_ems_cluster || resource.try(:ems_cluster), - parent_storage || resource.try(:storage), + parent_storage || resource.try(:storage) || resource.try(:cloud_volumes), parent_ems || resource.try(:ext_management_system), resource.try(:tenant) - ].compact + ].flatten.compact end def parents_determining_rate