[Solved] Undefined method "provision_class" on instance provisioning


#1

We’re getting an error here on instance provisioning (Capablanca over OpenStack):

Q-task_id([service_template_provision_request_13]) [NoMethodError]: undefined method `provision_class' for NilClass:Class  Method:[rescue in create_request_tasks]
Q-task_id([service_template_provision_request_13]) /var/www/miq/vmdb/app/models/miq_provision_request.rb:36:in `request_task_class_from'

Any help?


#2

The code is raising the error on the last line in this method as you point out.

  def self.request_task_class_from(attribs)
    source_id = MiqRequestMixin.get_option(:src_vm_id, nil, attribs['options'])
    vm_or_template = VmOrTemplate.find_by_id(source_id)
    raise MiqException::MiqProvisionError, "Unable to find source Template/Vm with id [#{source_id}]" if vm_or_template.nil?

    via = MiqRequestMixin.get_option(:provision_type, nil, attribs['options'])
    vm_or_template.ext_management_system.class.provision_class(via)
  end

We can tell that the vm_or_template object is valid (checked on the third line) but ext_management_system is nil which means the VM/Template being used for this service is no longer connected to the provider.

You will need to edit the catalog item and select a new template or recreate the catalog item to resolve this.


#3

Thanks @gmccullough!


#4

Hi @gmccullough

I need to raise this issue because have problems with the same error. For cloud providers the images who is source of the service template can be changed on provider side (removed, updated, etc). In this way there should be some intelligent way to hadle such cases I think.