Skip to content

Commit

Permalink
Add Resource_pool UI for Cloud managers
Browse files Browse the repository at this point in the history
  • Loading branch information
Guddetisandeep committed Nov 1, 2023
1 parent c0d0d23 commit 641d35f
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/controllers/mixins/ems_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def display_methods
physical_switches
physical_storages
placement_groups
resource_pools
security_groups
security_policies
security_policy_rules
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/vm_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ def placement_group
show_association('placement_groups', _('Placement Groups'), :placement_groups, PlacementGroup)
end

def resource_pool
show_association('resource_pools', _('Resource Pools'), :resource_pools, ResourcePool)
end

def cloud_subnets
show_association('cloud_subnets', _('Subnets'), :cloud_subnets, CloudSubnet)
end
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ def db_to_controller(db, action = "show")
when "PlacementGroup"
controller = "placement_group"
action = "show"
when "ResourcePool"
controller = "resource_pool"
action = "show"
when "SecurityGroup"
controller = "security_group"
action = "show"
Expand Down
12 changes: 11 additions & 1 deletion app/helpers/ems_cloud_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def textual_group_relationships
_("Relationships"),
%i[
ems_infra network_manager availability_zones host_aggregates cloud_tenants flavors
security_groups placement_groups instances images cloud_volumes orchestration_stacks storage_managers cloud_databases
security_groups placement_groups resource_pools instances images cloud_volumes orchestration_stacks storage_managers cloud_databases
custom_button_events tenant
]
)
Expand Down Expand Up @@ -131,6 +131,16 @@ def textual_placement_groups
h
end

def textual_resource_pools
num = @record.try(:resource_pools) ? @record.number_of(:resource_pools) : 0
h = {:label => _('Resource Pools'), :icon => "pficon pficon-resource-pool", :value => num}
if num.positive? && role_allows?(:feature => "resource_pool_show_list")
h[:title] = _("Show all Resource Pools")
h[:link] = ems_cloud_path(@record.id, :display => 'resource_pools')
end
h
end

def textual_cloud_databases
num = @record.try(:cloud_databases) ? @record.number_of(:cloud_databases) : 0
h = {:label => _('Cloud Databases'), :icon => "fa fa-database", :value => num}
Expand Down
20 changes: 19 additions & 1 deletion app/helpers/resource_pool_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def textual_group_configuration
_("Configuration"),
%i[
memory_reserve memory_reserve_expand memory_limit memory_shares memory_shares_level cpu_reserve
cpu_reserve_expand cpu_limit cpu_shares cpu_shares_level
cpu_reserve_expand cpu_limit cpu_shares cpu_shares_level cpu_cores_available cpu_cores_reserve cpu_cores_limit
]
)
end
Expand Down Expand Up @@ -188,4 +188,22 @@ def textual_cpu_shares_level
return nil if value.nil?
{:label => _("CPU Shares Level"), :value => value}
end

def textual_cpu_cores_available
value = @record.cpu_cores_available
return nil if value.nil?
{:label => _("CPU Cores Available"), :value => value}
end

def textual_cpu_cores_reserve
value = @record.cpu_cores_reserve
return nil if value.nil?
{:label => _("CPU Cores Reserve"), :value => value}
end

def textual_cpu_cores_limit
value = @record.cpu_cores_limit
return nil if value.nil?
{:label => _("CPU Cores Limit"), :value => (value == -1 ? _("Unlimited") : value)}
end
end
1 change: 1 addition & 0 deletions app/presenters/menu/default_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def clouds_menu_section
Menu::Item.new('orchestration_stack', N_('Stacks'), 'orchestration_stack', {:feature => 'orchestration_stack_show_list'}, '/orchestration_stack/show_list'),
Menu::Item.new('auth_key_pair_cloud', N_('Key Pairs'), 'auth_key_pair_cloud', {:feature => 'auth_key_pair_cloud_show_list'}, '/auth_key_pair_cloud/show_list'),
Menu::Item.new('placement_group', N_('Placement Groups'), 'placement_group', {:feature => 'placement_group_show_list'}, '/placement_group/show_list'),
Menu::Item.new('resource_pool', N_('Resource Pools'), 'resource_pool', {:feature => 'resource_pool_show_list'}, '/resource_pool/show_list'),
Menu::Item.new('cloud_databases', N_('Databases'), 'cloud_database', {:feature => 'cloud_database'}, '/cloud_database/show_list'),
])
end
Expand Down
1 change: 1 addition & 0 deletions spec/helpers/ems_cloud_helper/textual_summary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
flavors
security_groups
placement_groups
resource_pools
instances
images
cloud_volumes
Expand Down
3 changes: 3 additions & 0 deletions spec/helpers/resource_pool_helper/textual_summary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
cpu_limit
cpu_shares
cpu_shares_level
cpu_cores_available
cpu_cores_reserve
cpu_cores_limit
)

include_examples "textual_group_smart_management"
Expand Down

0 comments on commit 641d35f

Please sign in to comment.