From 9d50970db987db0511dbf0b64eecdb97a8e6f2d1 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