Quota check during dialog

Is there a way to get a users used quota during the dialog portion of a request? I would like to be able to show the user there current quota and possible even limit the flavors the user can select so they do have to submit a request that they don’t have quota for for it just to fail.

If you’re using tenant quotas then this should be quite simple, the current allocated/provisioned values are virtual columns on the tenant object, for example:

$evm.root['tenant'].allocated_memory = 48318382080   (type: Fixnum)
$evm.root['tenant'].allocated_storage = 498216206336   (type: Fixnum)
$evm.root['tenant'].allocated_vcpu = 23   (type: Fixnum)
$evm.root['tenant'].provisioned_storage = 546534588416   (type: Fixnum)

You might possibly be able to call/use the functionality of the existing System/CommonMethods/QuotaMethods/used method which does the calculations for the quota checking workflow. This is already doing the heavy lifting of finding out the existing usage, including checking in-flight provisions.

Hope this helps,

Hi @pemcg thanks for the reply. We were able to use the existing code from the quota methods to get the allocated usage for the user and then pull the max quota tags assign to the user or if none were defined pull the default quota settings for the region. The tricky part was getting the id for the user for the proper region as we have a multi region setup and a user id is created per region. We currently have this working and are in the process of disabling dialog fields based on the users remaining quota. If you would like details let me know and i can provide the code we setup so far.