Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2272054

Summary: [OSPdO 17.1] FencingConfig should be merged instead of replaced
Product: Red Hat OpenStack Reporter: Andrea Franceschini <afrances>
Component: osp-director-operator-containerAssignee: Ollie Walsh <owalsh>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 17.1 (Wallaby)CC: bshephar, chjones, jschluet, owalsh, pkomarov, ramishra
Target Milestone: z3Keywords: Triaged
Target Release: 17.1   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: osp-director-operator-container-1.3.1-15 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-05-29 19:51:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrea Franceschini 2024-03-28 14:35:05 UTC
Description of problem:

OSPdO configgenerator builds internally build a fencing.yaml environment file containing the FenceConfig for the controller's VM, implemented on top of CNV (KubeVirt).

When trying to add an external environment file  specifying the fencing config for the baremetal compute nodes (needed for instanceHA) , the external FencingConfig parameter overwrites the internal one.

Trying to specify in the external file a merge_strategy for that parameter to allow the 2 to be merged fails with a merge error:

This is the external file passed in env config map to the openstackconfiggenerator:

--------------------------------------------
parameters:
  FencingConfig:
    devices:
      level1:
      - agent: fence_ipmilan
      host_mac: 94:40:C9:37:34:F2
      params:
        ipaddr: 163.162.218.237
        lanplus: true
        login: xxxxx
        passwd: xxxxxxx
        pcmk_host_list: totp-cpt-dpdk6-0

parameter_merge_strategies:
  FencingConfig: deep_merge
--------------------------------------------------

This is the error:

--------------------------------------------------
ERROR: Conflicting merge strategy 'deep_merge' for parameter 'FencingConfig' in file 'file:///home/cloud-admin/tripleo-deploy-scratch/tripleo-heat-installer-templates/fencing_bmh.yaml'Version-Release number of selected component (if applicable):
--------------------------------------------------


How reproducible:

Enable Fencing on the OpenstackConfigGenerator Manifest, and add a env files containing an additional FencingConfig, with or withou parameter_merge_strategies specified.

If parameter_merge_strategies is omitted then, the OperatorFencingConfig for the VM is overwritten.

If parameter_merge_strategies is present for the parameter (deep_merge), then the openstack-config-generator jobs will fail with the above error.

Steps to Reproduce:
1.
2.
3.

Actual results:

The FencingConfig is either overwritten or the config fails.

Expected results:

The config succeed and the the internal and external FencingConfig are merged

Additional info:

Comment 1 Andrea Franceschini 2024-03-29 08:46:11 UTC
Hello,

the indentation in the example was incorrect, the problem still happens with the correct indentation.

Andrea

Comment 2 Brendan Shephard 2024-03-29 08:49:32 UTC
It looks like this is because FencingConfig has already been created and now updating it's merge_strategy would be in conflict with what already exists in the Stack. I think it would need to be set to deep_merge when the resource is first created, rather than trying to update the existing resources merge_strategy which by default [1] would be "override".

Looking at the unit tests[2] for this feature seem to confirm that suspicion. These tests seem to reinforce what I'm saying here, where the first environment file has conflicting merge_strategies when compared to the second one.

So, from Heat's perspective, I don't believe there is any bug here. To resolve this, we might consider creating the FencingConfig resource initially with the deep_merge strategy if that is the desired behavior.

[1] https://github.com/openstack/heat/blob/master/heat/common/environment_util.py#L33-L34
[2] https://github.com/openstack/heat/blob/master/heat/tests/test_common_env_util.py#L199-L223

Comment 3 Andrea Franceschini 2024-03-29 09:10:09 UTC
Hello Brendand,

indeed the problem is not on how heat is working, but, as you and owalsh (in a slack thread) pointed out, it is probably due to the fact that the first FencingConfig is created leaving the default merge_strategy to "override", so the fix should be applied to the way OSPdO generates the fencing.yaml maybe?

This is why I've open the bug under osp-director-container in the first place (hope this was the correct place)

Andrea

I add the link to the slack thread:

https://redhat-internal.slack.com/archives/C0567PMK78A/p1711439253869969

Comment 12 pkomarov 2024-05-23 12:58:10 UTC
Verified , 
FencingConfig was incorporated as default deep_merge:
[root@titan131 workspace]# grep -ir FencingConfig *
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212256253993/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps/tripleo-deploy-config-default.yaml:      FencingConfig:
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212256253993/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps/tripleo-deploy-config-default.yaml:      FencingConfig: deep_merge
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212256253993/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps.yaml:        FencingConfig:
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212256253993/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps.yaml:        FencingConfig: deep_merge
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212909190258/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps/tripleo-deploy-config-default.yaml:      FencingConfig:
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212909190258/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps/tripleo-deploy-config-default.yaml:      FencingConfig: deep_merge
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212909190258/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps.yaml:        FencingConfig:
DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/openstack-k8s/logs/must-gather-20240519T212909190258/quay-io-openstack-k8s-operators-must-gather-sha256-9af2867f0d06c5af3a5562ce133b66e94dacd6b487f00c111bc27315cc6df8d4/namespaces/openstack/core/configmaps.yaml:        FencingConfig: deep_merge
[root@titan131 workspace]# 

passing CI : 
https://rhos-ci-jenkins.lab.eng.tlv2.redhat.com/view/DFG/view/ospk8s/view/qe/job/DFG-ospk8s-osp-director-dev-tools-qe-17.1_hybrid_nfv_sriov_dpdk/46/

Comment 16 errata-xmlrpc 2024-05-29 19:51:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Red Hat OpenStack Platform 17.1 director Operator container images security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2024:2728