diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index 5256054fd26..986697ba5b9 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -138,6 +138,9 @@ def hostname_uniqueness_valid? virtual_column :total_vms_suspended, :type => :integer virtual_total :total_subnets, :cloud_subnets + virtual_aggregate :total_cloud_vcpus, :vms, :sum, :cpu_total_cores + virtual_aggregate :total_cloud_memory, :vms, :sum, :ram_size + alias_method :clusters, :ems_clusters # Used by web-services to return clusters as the property name alias_attribute :to_s, :name diff --git a/product/views/ManageIQ_Providers_CloudManager.yaml b/product/views/ManageIQ_Providers_CloudManager.yaml index 21c19f1f26c..84b31859b59 100644 --- a/product/views/ManageIQ_Providers_CloudManager.yaml +++ b/product/views/ManageIQ_Providers_CloudManager.yaml @@ -23,6 +23,8 @@ cols: - emstype_description - port - total_vms +- total_cloud_vcpus +- total_cloud_memory - total_miq_templates - region_description @@ -43,15 +45,27 @@ col_order: - emstype_description - zone.name - total_vms +- total_cloud_vcpus +- total_cloud_memory - total_miq_templates - region_description +col_formats: +- +- +- +- +- +- :megabytes_human + # Column titles, in order headers: - Name - Type - EVM Zone - Instances +- VCpus +- Memory - Images - Region diff --git a/spec/models/ext_management_system_spec.rb b/spec/models/ext_management_system_spec.rb index ca99e5cdd61..f0ea25e3709 100644 --- a/spec/models/ext_management_system_spec.rb +++ b/spec/models/ext_management_system_spec.rb @@ -258,7 +258,21 @@ context "with virtual totals" do before(:each) do @ems = FactoryGirl.create(:ems_vmware) - (1..2).each { |i| FactoryGirl.create(:vm_vmware, :ext_management_system => @ems, :name => "vm_#{i}") } + 2.times do + FactoryGirl.create(:vm_vmware, + :ext_management_system => @ems, + :hardware => FactoryGirl.create(:hardware, + :cpu1x2, + :ram1GB)) + end + end + + it "#total_cloud_vcpus" do + expect(@ems.total_cloud_vcpus).to eq(4) + end + + it "#total_cloud_memory" do + expect(@ems.total_cloud_memory).to eq(2048) end it "#total_vms_on" do