Skip to content

Commit

Permalink
Override memory_for_request
Browse files Browse the repository at this point in the history
PowerVS uses the more typical Flavor style of memory allocation for SAP
profiles. For non SAP profiles, the Flavor only sets the host type and
the user is allowed to request any amount of memory.
  • Loading branch information
jaywcarman committed Oct 18, 2023
1 parent 7036593 commit 93c7aaa
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,18 @@ def raw_delete_image
_log.error("image=[#{name}], error: #{e}")
end

def memory_for_request(request, flavor_id = nil)
flavor_obj = Flavor.find_by(:ems_id => ems_id, :name => request.options[:sys_type][1])
if flavor_obj.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile)
flavor_obj.try(:memory)
else
request.get_option(:vm_memory).to_i * 1.gigabytes
end
end

def number_of_cpus_for_request(request, flavor_id = nil)
flavor_obj = Flavor.find_by(:ems_id => ems_id, :name => request.options[:sys_type][1])
if flavor_obj.is_a?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile)
if flavor_obj.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile)
flavor_obj.try(:cpus)
else
request.get_option(:entitled_processors).to_f.ceil
Expand Down

0 comments on commit 93c7aaa

Please sign in to comment.