ifcfg: fix writer when changing OVS slave to clear previous settings

We need to reset the OVS_PORT and OVS_PORT_UUID variables.
Otherwise, clearing the slave type doesn't work.

On master this is solved differently, by automatically clearing all
variables that are not explicitly set.

Reproducer:

    nmcli con del t-eth1
    nmcli con add type ethernet autoconnect no ifname eth1 master port0 con-name t-eth1 slave-type ovs-port
    echo "
    remove ovs-interface
    remove connection.master
    remove connection.slave-type
    print
    save
    quit
    " | nmcli c edit t-eth1
    nmcli con show t-eth1 | grep 'ovs\|slave-type'

Fixes: 1440fe6a88 ('ifcfg: don't forget master of ovs interfaces')

https://bugzilla.redhat.com/show_bug.cgi?id=1804167
(cherry picked from commit 0c8046574e)
This commit is contained in:
Thomas Haller 2020-02-18 18:30:19 +01:00
parent 63c976e002
commit cc73cc2ecc
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1948,6 +1948,8 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
svSetValueStr (ifcfg, "BRIDGE", NULL);
svSetValueStr (ifcfg, "TEAM_MASTER_UUID", NULL);
svSetValueStr (ifcfg, "TEAM_MASTER", NULL);
svSetValueStr (ifcfg, "OVS_PORT_UUID", NULL);
svSetValueStr (ifcfg, "OVS_PORT", NULL);
master = nm_setting_connection_get_master (s_con);
if (master) {