nova.tests.unit.db.test_db_api sets up quotas incorrectly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Matt Riedemann |
Bug Description
Faced this problem when porting tests to python3. user_quotas[res] field is bring populated with the class object instead of hard_limit. python2 is magically allowing "user_quotas[res] >= 0" to succed when that variable has nova.db.
You can also reproduce this with the following patch:
diff --git a/nova/
index 16342e1..7e7e43a 100644
--- a/nova/
+++ b/nova/
@@ -3428,6 +3428,10 @@ def _calculate_
for res, delta in deltas.items():
# We can't go over-quota if we're not reserving anything or if
# we have unlimited quotas.
+ if not isinstance(
+ raise Exception(
+ % user_quotas[res])
+
if user_quotas[res] >= 0 and delta >= 0:
# over if the project usage + delta is more than project quota
if project_quotas[res] < delta + project_
Here's a sample output:
http://
Changed in nova: | |
milestone: | none → liberty-1 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | liberty-1 → 12.0.0 |
Confirmed in IRC, the user_quotas dict should be map of resources to ProjectUserQuot a.hard_ limit values, the test is setting it up incorrectly.