Hide Forgot
Description of problem: ManageIQ/System/CommonMethods/QuotaMethods.class/__methods__/limits.rb calculates $evm.parent[attr] for storage as MB when it is entered in tags and ManageIQ/System/CommonMethods/QuotaStateMachine/quota as GB. Version-Release number of selected component (if applicable): 5.6.2.2 Additional info: $ git diff ManageIQ/System/CommonMethods/QuotaMethods.class/__methods__/limits.rb diff --git i/ManageIQ/System/CommonMethods/QuotaMethods.class/__methods__/limits.rb w/ManageIQ/System/CommonMethods/QuotaMethods.class/__methods__/limits.rb index 37dde67..788b211 100644 --- i/ManageIQ/System/CommonMethods/QuotaMethods.class/__methods__/limits.rb +++ w/ManageIQ/System/CommonMethods/QuotaMethods.class/__methods__/limits.rb @@ -42,7 +42,9 @@ end def parent_model_value(attr) value = $evm.parent[attr].to_i $evm.log(:info, "Quota Model #{attr}: #{value}") unless value.zero? - if attr.ends_with?("storage") || attr.ends_with?("memory") + if attr.ends_with?("storage") + value = value.gigabytes + elsif attr.ends_with?("memory") value = value.megabytes end value
Created attachment 1219542 [details] Quota class schema
Created attachment 1219543 [details] Tag max storage
Created attachment 1219544 [details] Tag max memory
Hi Jeffrey, The tag category descriptions for “Quota - Max Memory" and “Quota - Max Storage” both say (GB), but the tag values for memory and storage are inconsistent. For example, the tag value for “Quota - Storage” 10GB is 10. the tag value for “Quota - Memory” 10GB is 10240. (see screenshots) The limits quota method tag_value adjusts for this: def tag_value(tag, tag_value) value = tag_value.to_i $evm.log(:info, "Quota Tag #{tag}: #{value}") unless value.zero? if tag == :quota_max_storage value = value.gigabytes elsif tag == :quota_max_memory value = value.megabytes end value end The ManageIQ/System/CommonMethods/QuotaMethods/quota instance values ($evm.parent[attr]) are in megabytes. The default instance values for the ManageIQ/System/CommonMethods/QuotaMethods/quota Storage Warning Limit is 1024(1GB) Storage Maxiumum LImit is 2048(2GB) Memory Warning Limit is 1024(1GB) Memory Maxiumum LImit is 2048(2GB) (see screenshot) The limits method parent_model_value calculates this: def parent_model_value(attr) value = $evm.parent[attr].to_i $evm.log(:info, "Quota Model #{attr}: #{value}") unless value.zero? if attr.ends_with?("storage") || attr.ends_with?(“memory”) value = value.megabytes end value end Besides the confusion of tag/model values, are the quota results incorrect? Thanks, Tina
Hi Tina, The results being incorrect is what drew my attention to the problem. In limits.rb, tag_value only gets run if $evm.root['quota_source_type'] is tenant. So if quota_source_type is not tenant (in my case it was group) method parent_model_value gets used instead and treats both storage and memory as megabytes. The diff from my changes which I included previously did resolve this issue for us. Thanks, -Jeff
Hi Jeff, I spoke to Kevin Morey about this ticket and he pointed out that we still have the old quota classes where the memory is in MB and storage is in GB. I didn't realize the old quota classes were still there and that's probably a lot of the confusion. We created a PR to remove the classes: https://github.com/ManageIQ/manageiq/pull/12661 The new consolidated quota memory and quota values are in megabytes. Let me know if you have any questions. Thanks, Tina