From 98469261b78e82d0c99c5825acbf2a6ee93eb216 Mon Sep 17 00:00:00 2001 From: Jay Carman Date: Thu, 24 Aug 2023 11:17:21 -0500 Subject: [PATCH] Override number_of_cpus_for_request PowerVS uses the more typical Flavor style of cpu allocation for SAP profiles. For non SAP profiles, the Flavor only sets the host type and the user is allowed to request any number of cpus using the entitled_processors form option. --- .../power_virtual_servers/cloud_manager/template.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/template.rb b/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/template.rb index 7b40e8247..d5078e352 100644 --- a/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/template.rb +++ b/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/template.rb @@ -59,6 +59,15 @@ def raw_delete_image _log.error("image=[#{name}], error: #{e}") 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.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile) + flavor_obj.try(:cpus) + else + request.get_option(:entitled_processors).to_f.ceil + end + end + def self.raw_import_image(ext_management_system, options = {}) session_id = SecureRandom.uuid wrkfl_timeout = options['timeout'].to_i.hours