Provisioning and Service Quota has been available in ManageIQ/CloudForms for a long time.
How Quota works is explained beautifully by Peter McGowan, however, quota only applies during initial provisioning.
Enabling quota verification during VM reconfiguration would be really useful.
Calling the StateMachine
Firstly, we need to invoke the Quota StateMachine during a VM reconfiguration request.
This is done by adding a VmReconfigureRequest_starting instance in /System/Policy, with a Relationship to the existing StateMachine.
Reading the Request
Secondly, we need to modify Quota StateMachine request method, since the standard method isn't expecting the miq_request type of VmReconfigureRequest.
Request VM reconfiguration as usual and quota will be validated.