From 36cd97a5f3afea5f25b2626f7f885bbac9a3cc04 Mon Sep 17 00:00:00 2001 From: Jay Carman Date: Fri, 1 Sep 2023 08:46:21 -0500 Subject: [PATCH] Allow flavor ID override in request calc methods If a service request includes a flavor override it needs to be passed to the template *_for_request calculation methods. --- .../manageiq/providers/cloud_manager/template.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/manageiq/providers/cloud_manager/template.rb b/app/models/manageiq/providers/cloud_manager/template.rb index d92c6cbec614..458e8d9edf84 100644 --- a/app/models/manageiq/providers/cloud_manager/template.rb +++ b/app/models/manageiq/providers/cloud_manager/template.rb @@ -155,13 +155,15 @@ def self.display_name(number = 1) n_('Image', 'Images', number) end - def memory_for_request(request) - flavor_obj = Flavor.find(request.get_option(:instance_type)) + def memory_for_request(request, flavor_id = nil) + flavor_id ||= request.get_option(:instance_type) + flavor_obj = Flavor.find(flavor_id) flavor_obj.try(:memory) end - def number_of_cpus_for_request(request) - flavor_obj = Flavor.find(request.get_option(:instance_type)) + def number_of_cpus_for_request(request, flavor_id = nil) + flavor_id ||= request.get_option(:instance_type) + flavor_obj = Flavor.find(flavor_id) flavor_obj.try(:cpus) end