default_enabled_filters nova.conf updates don't get written on openstack upgrade

Bug #2037751 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Nova Cloud Controller Charm
Fix Committed
Undecided
Unassigned

Bug Description

While testing https://bugs.launchpad.net/charm-nova-cloud-controller/+bug/2036766 with updated filters in
default_enabled_filters() (called by NovaConfigContext), the new filters aren't getting rendered to nova.conf after the openstack upgrade in the config-changed hook.

On the upgrade from antelope->bobcat, the following call to os_release() is returning a cached version of "antelope".

def default_enabled_filters():
    os_rel = ch_utils.os_release('nova-common')
    if cmp_os_rel >= 'bobcat':
        return _bobcat_enabled_filters
    if cmp_os_rel >= 'victoria':
        return _victoria_enabled_filters
    if cmp_os_rel >= 'pike':

There's a reset_cache parameter for os_release(), but in this case it didn't change anything because os_release() calls into other functions that don't account for that parameter.

On down the line os_release() ends up getting the release from get_installed_os_version() which calls openstack_release():

@cached
def openstack_release():
    """Return /etc/os-release in a dict."""
    d = {}
    try:
        with open('/etc/openstack-release', 'r') as lsb:
            for l in lsb:
                s = l.split('=')
                if len(s) != 2:
                    continue
                d[s[0].strip()] = s[1].strip()
    except FileNotFoundError:
        pass
    return d

Removing the @cached decorator from this function allows "bobcat" to get returned and the nova.conf rendered correctly. I don't know that the caching is really necessary here since there is already caching at a higher level function.

description: updated
description: updated
Changed in charm-nova-cloud-controller:
status: New → In Progress
summary: - default_enabled_filters nova.conf updates don't get written on opentack
+ default_enabled_filters nova.conf updates don't get written on openstack
upgrade
Revision history for this message
Corey Bryant (corey.bryant) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-nova-cloud-controller (master)

Reviewed: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/895840
Committed: https://opendev.org/openstack/charm-nova-cloud-controller/commit/5cf66c87c797e4f7549bc7cd9f5d57c624d30d00
Submitter: "Zuul (22348)"
Branch: master

commit 5cf66c87c797e4f7549bc7cd9f5d57c624d30d00
Author: Corey Bryant <email address hidden>
Date: Tue Sep 19 14:00:33 2023 -0400

    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

Changed in charm-nova-cloud-controller:
status: In Progress → Fix Committed
Changed in charm-guide:
status: New → In Progress
no longer affects: charm-guide
Revision history for this message
Corey Bryant (corey.bryant) wrote :

This charm-helpers change is likely needed in other charms/releases so I'm going to backport the change to wallaby+. It would only be needed as early as wallaby because that's where the openstack-release package was introduced:

openstack-release | 1.0ubuntu1~cloud0 | wallaby | focal-updates | source

no longer affects: charm-nova-cloud-controller/2023.1
no longer affects: charm-nova-cloud-controller/wallaby
no longer affects: charm-nova-cloud-controller/xena
no longer affects: charm-nova-cloud-controller/yoga
no longer affects: charm-nova-cloud-controller/zed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.