Skip to content

Commit

Permalink
Allow flavor ID override in request calc methods
Browse files Browse the repository at this point in the history
If a service request includes a flavor override it needs to be passed to
the template *_for_request calculation methods.
  • Loading branch information
jaywcarman committed Sep 1, 2023
1 parent 576cce0 commit 36cd97a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/models/manageiq/providers/cloud_manager/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 36cd97a

Please sign in to comment.