[openstack-dev] [cross-project][quotas][delimiter]My thoughts on how Delimiter uses generation-id for sequencing
qijing_li at symantec40.com
Sun May 15 08:16:25 UTC 2016
Here is my thoughts on how Delimiter uses generation-id to guarantee
sequencing. Please correct me if I understand it wrong.
First, the Delimiter need to introduce another model ResourceProvider who
has two attributes:
The followings are the steps of how to consume a quota:
Step 1. Check if there is enough available quota
If yes, then get the $generation_id by querying the model
ResourceProvider with the given resource_id which is the point in time view
of resource usage.
If no, terminate the process of consuming the quota and return the
message of “No enough quotas available."
Step 2. Consume the quota.
2.1 Begin transaction
2.2 Update the QuotaUsage model: QuotaUsage.in_use = QuotaUsage.in_use +
amount of quota requested.
2.3 Get the $generation_id by querying the ResourceProvider by the given
If the $generation_id is larger than the $generation_id in Step 1,
then roll back transaction and GOTO step 1.
this case means there is someone else has changed the QuotaUsage
during this process.
If the $generation_id is the same as the $generation_id in Step 1,
then increase the ResourceProvider.generation_id by one and
Commit the transaction. Done!
Note: no case the $generation_id is less than the $generation_id in
Step 1 because the $generation_id is nondecreasing.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OpenStack-dev