Bug 2053100

Summary: nmstate rust removes untouched keys under `ovs-db`
Product: Red Hat Enterprise Linux 9 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.1CC: ferferna, jiji, jishi, network-qe, sfaye, till
Target Milestone: rcKeywords: Triaged
Target Release: 9.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:30:59 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 Mingyu Shi 2022-02-10 14:31:31 UTC
Description of problem:
Compared with nmstate python, nmstate rust removes untouched keys under `ovs-db`
when modifying `ovs-db`.

Version-Release number of selected component (if applicable):
nmstate-1.2.1-0.2.alpha2.el8.x86_64
nispor-1.2.3-1.el8.x86_64
NetworkManager-1.36.0-0.7.el8.x86_64
openvswitch2.15-2.15.0-70.el8fdp.x86_64

How reproducible:
100%

Steps to Reproduce:
echo "
ovs-db:
  external_ids:
    hostname: dell-per740-02.rhts.eng.pek2.redhat.com
    rundir: /var/run/openvswitch
    system-id: 590f838a-2515-4fe7-a44d-de1553389bd6
  other_config: {}
" | nmstatectl-rust apply

echo "
ovs-db:
  external_ids: {foo: bar}
  other_config: {UP: DOWN}
" | nmstatectl-rust apply

nmstatectl show # check `ovs-db` key

Actual results:
ovs-db:
  external_ids:
    foo: bar
  other_config:
    UP: DOWN

Expected results:
(If using nmstate python)
ovs-db:
  external_ids:
    foo: bar
    hostname: dell-per740-02.rhts.eng.pek2.redhat.com
    rundir: /var/run/openvswitch
    system-id: 590f838a-2515-4fe7-a44d-de1553389bd6
  other_config:
    UP: DOWN

Additional info:

Comment 1 Gris Ge 2022-07-27 07:57:35 UTC
Change to RHEL 9 and targeting 9.2

Comment 2 Gris Ge 2022-08-24 09:32:47 UTC
Patch posted to upstream: https://github.com/nmstate/nmstate/pull/2015

Allowing partial editing on ovs-db global config:
     * Merging desire from current.
     * Will remove all ovs-db global configure for `ovs-db: {}`.
     * To remove single entry, use `foo: null` in yaml.

Comment 3 Mingyu Shi 2022-08-25 02:31:43 UTC
Pretested
nmstate-2.2.0-0.20220824093819832661.pr2015.11.g225cf980.el9.x86_64
NetworkManager-1.39.90-1.el9.x86_64

The only difference, or improvement, is that the value of `ovs-db.other_config.foo` cannot be integer in the python version, while the rust version can automatically convert integer 1 to string "1" and make it work.

Comment 8 Mingyu Shi 2022-10-24 11:04:23 UTC
Verified with:
nmstate-2.2.0-0.alpha.20221014.el9.x86_64
NetworkManager-1.40.0-1.el9.x86_64
openvswitch2.15-2.15.0-72.el9fdp.x86_64
Linux dell-per740-79.rhts.eng.pek2.redhat.com 5.14.0-176.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 12 05:23:43 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
DISTRO=RHEL-9.2.0-20221016.3

Comment 10 errata-xmlrpc 2023-05-09 07:30:59 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 (nmstate bug fix and enhancement 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/RHBA-2023:2190