From 5cf66c87c797e4f7549bc7cd9f5d57c624d30d00 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Tue, 19 Sep 2023 14:00:33 -0400 Subject: [PATCH] Drop AvailabilityZoneFilter inline with upstream removal The was removed from upstream nova in the 2023.2 cycle via commit 5edd805fe2395f35ecdfe5b589a51dc00565852f. The nova release note states: The ``AvailabilityZoneFilter`` was deprecated for removal in 24.0.0 (Xena) and has now been removed. The functionality of the``AvailabilityZoneFilter`` has been replaced by the``map_az_to_placement_aggregate`` pre-filter. The pre-filter was introduced in 18.0.0 (Rocky) and enabled by default in 24.0.0 (Xena). This pre-filter is now always enabled and the ``[scheduler] query_placement_for_availability_zone`` config option has been removed. This change also syncs the charm-helpers change from: https://github.com/juju/charm-helpers/pull/850 Closes-Bug: #2037751 Closes-Bug: #2036766 Change-Id: I315900a7e32ec66b27fa69961e9b7dcb9fa1f949 --- charmhelpers/contrib/openstack/utils.py | 1 - hooks/nova_cc_context.py | 11 +++++++++++ unit_tests/test_nova_cc_contexts.py | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/charmhelpers/contrib/openstack/utils.py b/charmhelpers/contrib/openstack/utils.py index e98be2c5..ee492245 100644 --- a/charmhelpers/contrib/openstack/utils.py +++ b/charmhelpers/contrib/openstack/utils.py @@ -585,7 +585,6 @@ def get_installed_os_version(): return openstack_release().get('OPENSTACK_CODENAME') -@cached def openstack_release(): """Return /etc/os-release in a dict.""" d = {} diff --git a/hooks/nova_cc_context.py b/hooks/nova_cc_context.py index 4f072b1d..b5786791 100644 --- a/hooks/nova_cc_context.py +++ b/hooks/nova_cc_context.py @@ -381,6 +381,15 @@ _victoria_enabled_filters = [ "DifferentHostFilter", "SameHostFilter", ] +_bobcat_enabled_filters = [ + "ComputeFilter", + "ComputeCapabilitiesFilter", + "ImagePropertiesFilter", + "ServerGroupAntiAffinityFilter", + "ServerGroupAffinityFilter", + "DifferentHostFilter", + "SameHostFilter", +] def default_enabled_filters(): @@ -392,6 +401,8 @@ def default_enabled_filters(): """ os_rel = ch_utils.os_release('nova-common') cmp_os_rel = ch_utils.CompareOpenStackReleases(os_rel) + if cmp_os_rel >= 'bobcat': + return _bobcat_enabled_filters if cmp_os_rel >= 'victoria': return _victoria_enabled_filters if cmp_os_rel >= 'pike': diff --git a/unit_tests/test_nova_cc_contexts.py b/unit_tests/test_nova_cc_contexts.py index e75ba89f..09d6c34c 100644 --- a/unit_tests/test_nova_cc_contexts.py +++ b/unit_tests/test_nova_cc_contexts.py @@ -738,3 +738,8 @@ class NovaComputeContextTests(CharmTestCase): self.os_release.return_value = 'victoria' self.assertEqual(context.default_enabled_filters(), context._victoria_enabled_filters) + + def test_default_enabled_filters_bobcat(self): + self.os_release.return_value = 'bobcat' + self.assertEqual(context.default_enabled_filters(), + context._bobcat_enabled_filters)