Service provision error: MiqProvision_Complete - VM not found


I’m trying to provision a service via catalog item on openstack cloud. I was first getting error about task being nil in check_provisioned:

[----] I, [2015-01-23T19:29:01.805145 #26490:94c014] INFO – : Q-task_id([service_template_provision_task_33]) <AEMethod [ManageIQ/Service/Provisioning/StateMachines/Methods/check_provisioned]> Ending
[----] I, [2015-01-23T19:29:01.805268 #26490:94c014] INFO – : Q-task_id([service_template_provision_task_33]) Method exited with rc=MIQ_OK
[----] I, [2015-01-23T19:29:01.805651 #26490:94c014] INFO – : Q-task_id([service_template_provision_task_33]) Followed Relationship [miqaedb:/Service/Provisioning/StateMachines/Methods/CheckProvisioned#cre
[----] I, [2015-01-23T19:29:01.805875 #26490:94c014] INFO – : Q-task_id([service_template_provision_task_33]) Processed State=[checkprovisioned] with Result=[error]
[----] W, [2015-01-23T19:29:01.806139 #26490:94c014] WARN – : Q-task_id([service_template_provision_task_33]) Error in State=[checkprovisioned]
[----] I, [2015-01-23T19:29:01.807211 #26490:94c014] INFO – : Q-task_id([service_template_provision_task_33]) In State=[checkprovisioned], invoking [on_error] method=[update_serviceprovision_status(status => ‘[NoMethodError]: undefined method `state’ for nil:NilClass’,status_state => ‘on_error’)]
[----] I, [2015-01-23T19:29:01.807514 #6136:955808] INFO – : Updated namespace [miqaedb:/System/Event/scheduler.select_destinations.start#create ManageIQ/System]

I “fixed” that by simply ignoring it - I copied method, and edited code to simply return with MIQ_OK if task is nil. Now the VM is stared on the openstack, but MIQ doesn’t know about that VM. E.g a new MIQ service is show, but no VM is attached to that service. Error is:

[----] I, [2015-01-26T06:49:44.032036 #13208:fa800c] INFO – : Q-task_id([miq_provision_85]) Invoking [inline] method [ManageIQ/Cloud/VM/Provisioning/Email/MiqProvision_Complete] with inputs [{}]
[----] I, [2015-01-26T06:49:44.032984 #13208:fa800c] INFO – : Q-task_id([miq_provision_85]) <AEMethod [ManageIQ/Cloud/VM/Provisioning/Email/MiqProvision_Complete]> Starting
[----] I, [2015-01-26T06:49:44.370964 #13208:5b21efc] INFO – : Q-task_id([miq_provision_85]) MiqProvision_Complete - EVM Automate Method Started
[----] E, [2015-01-26T06:49:44.375500 #13208:5b21efc] ERROR – : Q-task_id([miq_provision_85]) MiqProvision_Complete - [MiqProvision_Complete - VM not found]
<code: raise “#{@method} - VM not found” if vm.nil?>:28:in `’
[----] I, [2015-01-26T06:49:44.385218 #13208:fa800c] INFO – : Q-task_id([miq_provision_85]) <AEMethod [ManageIQ/Cloud/VM/Provisioning/Email/MiqProvision_Complete]> Ending
[----] I, [2015-01-26T06:49:44.385837 #13208:fa800c] INFO – : Q-task_id([miq_provision_85]) Stopping instantiation because [Method exited with rc=MIQ_STOP]

What should I do, to get newly started VM assigned to the newly created service?

Looks like you are running into the issue that was fixed with this PR:

It is a one line change that you can try to apply locally or grab the nightly build to test out.

I’m using the stable build, my openstack is juno, and VM is created in non-admin tenant. Applied the change, and it does help. Service is now created without error, in log is:

[----] I, [2015-01-26T18:33:26.983110 #6444:c1280c] INFO – : Q-task_id([miq_provision_117]) Invoking [inline] method [ManageIQ/Cloud/VM/Provisioning/Email/MiqProvision_Complete] with inputs [{}]
[----] I, [2015-01-26T18:33:26.983933 #6444:c1280c] INFO – : Q-task_id([miq_provision_117]) <AEMethod [ManageIQ/Cloud/VM/Provisioning/Email/MiqProvision_Complete]> Starting
[----] I, [2015-01-26T18:33:27.338149 #6444:4ecce68] INFO – : Q-task_id([miq_provision_117]) MiqProvision_Complete - EVM Automate Method Started
[----] I, [2015-01-26T18:33:27.372788 #6444:4ecce68] INFO – : Q-task_id([miq_provision_117]) MiqProvision_Complete - VM Owner: nil
[----] I, [2015-01-26T18:33:27.393520 #6444:4ecce68] INFO – : Q-task_id([miq_provision_117]) MiqProvision_Complete - Sending email to from subject: <Your virtual machine request has Completed - VM: user-cirros-nopass_0030>

So VM is now correctly identified. But the MIQ user demo (which created the service from catalog item) clicks on the service, it shows “no records found” for VMs. MIQ admin user sees the VM details. I guess I should now add some additional permission to the demo user role?