summaryrefslogtreecommitdiff
path: root/nova
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2023-03-06 18:57:21 +0000
committerGerrit Code Review <review@openstack.org>2023-03-06 18:57:21 +0000
commitc4fe563bdd21e8800e0e2964b51f2970363715fe (patch)
tree9abf4ccf3fc5d45108a181eae870c97dbfa30f6d /nova
parent595443a1caab5e7acfd668fc546a146380072c0f (diff)
parentd53372790435a003723a29cb15ac044b014a0e89 (diff)
downloadnova-c4fe563bdd21e8800e0e2964b51f2970363715fe.tar.gz
Merge "testing: Reset affinity support global variables"
Diffstat (limited to 'nova')
-rw-r--r--nova/scheduler/utils.py11
-rw-r--r--nova/test.py7
2 files changed, 18 insertions, 0 deletions
diff --git a/nova/scheduler/utils.py b/nova/scheduler/utils.py
index c7e6ffed97..02c44093bd 100644
--- a/nova/scheduler/utils.py
+++ b/nova/scheduler/utils.py
@@ -1080,6 +1080,17 @@ _SUPPORTS_SOFT_AFFINITY = None
_SUPPORTS_SOFT_ANTI_AFFINITY = None
+def reset_globals():
+ global _SUPPORTS_AFFINITY
+ _SUPPORTS_AFFINITY = None
+ global _SUPPORTS_ANTI_AFFINITY
+ _SUPPORTS_ANTI_AFFINITY = None
+ global _SUPPORTS_SOFT_AFFINITY
+ _SUPPORTS_SOFT_AFFINITY = None
+ global _SUPPORTS_SOFT_ANTI_AFFINITY
+ _SUPPORTS_SOFT_ANTI_AFFINITY = None
+
+
def _get_group_details(context, instance_uuid, user_group_hosts=None):
"""Provide group_hosts and group_policies sets related to instances if
those instances are belonging to a group and if corresponding filters are
diff --git a/nova/test.py b/nova/test.py
index 0f7965ea33..e37967b06d 100644
--- a/nova/test.py
+++ b/nova/test.py
@@ -62,6 +62,7 @@ from nova import objects
from nova.objects import base as objects_base
from nova import quota
from nova.scheduler.client import report
+from nova.scheduler import utils as scheduler_utils
from nova.tests import fixtures as nova_fixtures
from nova.tests.unit import matchers
from nova import utils
@@ -310,6 +311,12 @@ class TestCase(base.BaseTestCase):
if self.STUB_COMPUTE_ID:
self.useFixture(nova_fixtures.ComputeNodeIdFixture())
+ # Reset globals indicating affinity filter support. Some tests may set
+ # self.flags(enabled_filters=...) which could make the affinity filter
+ # support globals get set to a non-default configuration which affects
+ # all other tests.
+ scheduler_utils.reset_globals()
+
def _setup_cells(self):
"""Setup a normal cellsv2 environment.