Fix restoring quotas bug while rally cleanup

If task has contexts.quotas, it runs quotas cleanup after running test. And if running with existing_users, save tenants' quota at setup and restore after the running, while quotas cleanup. But checking existing users in context does not work well. This commit checks correctly that existing_users key is in context.

Closes-Bug: #2119493
Change-Id: Id67722296294a10abe7f3b83badd8b586734a709
Signed-off-by: eunkyung <ek121.kim@samsung.com>
This commit is contained in:
Eunkyung99
2025-08-05 14:01:37 +09:00
parent 48e20b5d55
commit 8e8e9b53fe
3 changed files with 9 additions and 4 deletions

View File

@@ -38,6 +38,11 @@ Changed
* Implements pep-517 (pyproject.toml) and replaces pbr dependency
with setuptools-scm
Fixed
~~~~~
* Fix restoring quotas bug while rally cleanup
[3.0.0] - 2024-05-23
--------------------

View File

@@ -71,7 +71,7 @@ class Quotas(context.OpenStackContext):
# NOTE(andreykurilin): in case of existing users it is
# required to restore original quotas instead of reset
# to default ones.
if "existing_users" in self.context:
if "existing_users" in self.context["config"]:
self.original_quotas.append(
(service, tenant_id,
self.manager[service].get(tenant_id)))

View File

@@ -101,7 +101,7 @@ class QuotasTestCase(test.TestCase):
cinder_quo = mock_cinder_quotas.return_value
ctx = copy.deepcopy(self.context)
if ex_users:
ctx["existing_users"] = None
ctx["config"]["existing_users"] = None
ctx["config"]["quotas"] = {
"cinder": {
"volumes": self.unlimited,
@@ -138,7 +138,7 @@ class QuotasTestCase(test.TestCase):
nova_quo = mock_nova_quotas.return_value
ctx = copy.deepcopy(self.context)
if ex_users:
ctx["existing_users"] = None
ctx["config"]["existing_users"] = None
ctx["config"]["quotas"] = {
"nova": {
@@ -185,7 +185,7 @@ class QuotasTestCase(test.TestCase):
neutron_quo = mock_neutron_quotas.return_value
ctx = copy.deepcopy(self.context)
if ex_users:
ctx["existing_users"] = None
ctx["config"]["existing_users"] = None
ctx["config"]["quotas"] = {
"neutron": {