Preserve ceph monitor order for overrides

Generated ceph monitor data is stored in a normal Python dict.
When iterating over it we don't have a guaranteed order.
Use OrderedDict to align to the database order.
This is needed to remove differences between app overrides.
Example of iteration:
Database may return 1,2,3, but adding these values into the dict, then
parsing the dict may result in iterating over 3,1,2.

Beside obvious optimization of not applying the apps again there is
one more reason for this change.
It was observed that a FluxCD apply operation was rejected by
kubernetes because the resource StorageClass parameters were changed.
Investigation based on collected logs showed the only diff between
overrides was the monitor order.

This was discovered in a Standard system upgrade scenario.
This needs to be patched back, and users need to re-apply
platform-integ-apps before starting the upgrade procedure.
Recommended procedure would be to remove, then apply
platform-integ-apps.

Tests on CentOS:
Using helm-override-show for rbd-provisioner and kubectl to describe
the storage classes. Monitors out of alignment. Patched
live Storage system, then monitors became correctly ordered.
Could apply platform-integ-apps without removing.

Tests on Debian:
Full Storage lab deployment.
Unlocked enabled available.

Closes-Bug: 1995352
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I481eee9e79d4fdf0d17472fa11f3c085c25e34fc
This commit is contained in:
Dan Voiculeasa 2022-11-01 10:43:34 +02:00
parent b4b19c8569
commit 01cee7e0fc

View File

@ -1,7 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016-2021 Wind River Systems, Inc.
# Copyright (c) 2016-2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -14,6 +14,8 @@
import ast
import pecan
from collections import OrderedDict
from oslo_log import log
from sysinv.common import constants
from sysinv.common import exception
@ -221,7 +223,7 @@ class StorageBackendConfig(object):
hostif = '%s-%s' % (host, network_type)
hostif2ph[hostif] = ph
# map placeholder to ceph-mon ip address
ph2ipaddr = {}
ph2ipaddr = OrderedDict({})
for addr in dbapi.addresses_get_all():
if addr.name in hostif2ph:
ph = hostif2ph[addr.name]