Skip to content

Commit

Permalink
VCpus and Memory for Cloud Providers visual
Browse files Browse the repository at this point in the history
  • Loading branch information
aljesusg committed Dec 13, 2016
1 parent bb18704 commit c83b855
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions product/views/ManageIQ_Providers_CloudManager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ cols:
- emstype_description
- port
- total_vms
- total_cloud_vcpus
- total_cloud_memory
- total_miq_templates
- region_description

Expand All @@ -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

Expand Down
16 changes: 15 additions & 1 deletion spec/models/ext_management_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c83b855

Please sign in to comment.