From edff6fbf5d80dba05ab57b557ee25f44098bdf13 Mon Sep 17 00:00:00 2001 From: Ryan McNair Date: Mon, 7 Mar 2016 18:42:22 +0000 Subject: [PATCH] Don't disallow quota deletion if allocated < 0 Due to the race condition http://bugs.launchpad.net/cinder/+bug/1552944, it's possible that a volume delete on a project at the same time as a change to/from a -1 limit on the project could double count the change in allocated value. This has the possibility to set allocated < 0, and in order to handle this situation as gracefully as possible, we should not disallow quota deletion in the case that allocated < 0. Change-Id: Ic35ff9671024aa1cecc04b205d1b7cba56bbea61 Closes-Bug: #1554173 --- cinder/api/contrib/quotas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinder/api/contrib/quotas.py b/cinder/api/contrib/quotas.py index 08490bdf1fd..e1718cca9e1 100644 --- a/cinder/api/contrib/quotas.py +++ b/cinder/api/contrib/quotas.py @@ -395,7 +395,7 @@ class QuotaSetsController(wsgi.Controller): # deleted first. for res, value in project_quotas.items(): if 'allocated' in project_quotas[res].keys(): - if project_quotas[res]['allocated'] != 0: + if project_quotas[res]['allocated'] > 0: msg = _("About to delete child projects having " "non-zero quota. This should not be performed") raise webob.exc.HTTPBadRequest(explanation=msg)