Quota_source method suddenly getting nil objects

Hello, I’ve been working on customizing our workflow for provisioning VMs, and suddenly, after weeks of working successfully, the quota_source method is getting “nil” values for attributes and methods. I am using Ivanchuk-4.

I am using the “default” methods and instances from the /Sytem/CommonMethods/QuotaMethods schema, but do have a custom quota instance in /SYstem/CommonMethods/QuotaStateMachines that defines quota_source_type as ‘user’ and sets the warning and max values that are desired as the default per-user values.

This has been working until recently, as I am trying to customize the Service/VM provisioning workflow, in particular the handoff from MIQ to Embedded Ansible, and it just stopped working. The main custom section I’ve added to my domain is for VM Naming, and setting up instances/methods for calling the ansible playbooks.

The automation.log file shows that the “quota_source_type” is coming through as a nil value, which causes the method to abort at line 8 of quota_source, since $evm.root[‘quota_source_type’] is somehow nil, though line 6 $evm.object[‘quota_source_type’] should be ‘user’ from the quota instance attribute by that name.

I then cloned the quota_source method and instance, and changed line 6 to set a default value of ‘user’, but then the nil problem just moves to line 12, and the new error that cannot call method ‘requester’ on nil object. I think that this means that somehow, in this execution, the $evm object is not getting setup correctly.

I can’t think of anything I’ve changed that could impact this. The only major system change i have made recently is replacing the default https certificate with ones signed by our internal CA. I did not switch the database connection to use SSL.

Thanks in advance for any suggestions on how to resolve. My only thought on how to recover, given my lack of understanding of the issue, is to provision a new MIQ appliance (VMware provider) and export my domain and settings to it to start over cleanly.

Check the priority order of your automate domains, sometimes things can be defined in an instance in a lower priority domain without releasing it, and then a method in a higher priority domain reads the “wrong” instance.

Maybe also try dumping your $evm.root and/or $evm.object with InspectMe or object_walker as that might give you an idea of what’s going on.

pemcg

Thanks for the suggestions of things to check.

Taking the exercise to trace how quota_source was being triggered led me back to my custom Naming method and some recent changes that I had forgotten had been made to try to generate unique VM names when multiple provisioning requests are in process.

object_walker was showing that $evm.root[‘miq_request’] was not set to anything, possibly because quota_source was being called as a related instance from the naming instance.