Skip to content

Commit

Permalink
Fixes ovs-configuration with cloned connections
Browse files Browse the repository at this point in the history
When using nm clone for a connection where we cannot find the current
keyfile, the file is assumed to be in the regular NM keyfile path.
However on platforms using the "merged" keyfile path, this fails,
because the file only exists in the merged directory.

Additionally, after we copy the cloned file to edit for static IP
addressing, NM will fail to load it because of selinux. Therefore we
need to restorecon after we copy it.

Signed-off-by: Tim Rozet <[email protected]>
  • Loading branch information
trozet committed Feb 10, 2021
1 parent 99522b9 commit f99c1bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions templates/common/_base/files/configure-ovs-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ contents:
ifconfig "$intf" allmulti
fi
}
NM_CONN_PATH="/etc/NetworkManager/system-connections"
if [ -d "/etc/NetworkManager/system-connections-merged" ]; then
NM_CONN_PATH="/etc/NetworkManager/system-connections-merged"
else
NM_CONN_PATH="/etc/NetworkManager/system-connections"
fi
iface=""
counter=0
# find default interface
Expand Down Expand Up @@ -196,6 +199,7 @@ contents:
echo "WARN: existing br-ex interface file found: $new_conn_file, which is not loaded in NetworkManager...overwriting"
fi
cp -f ${old_conn_file} ${new_conn_file}
restorecon ${new_conn_file}
if $cloned; then
nmcli conn delete ${old_conn}-clone
rm -f ${old_conn_file}
Expand Down

0 comments on commit f99c1bb

Please sign in to comment.