Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confignetwork / nicutils.sh ends with error if connection name contains white space #7483

Open
OliverTUBAF opened this issue Dec 6, 2024 · 0 comments

Comments

@OliverTUBAF
Copy link

OliverTUBAF commented Dec 6, 2024

I was trying to setup a bridge interface on one node, but the connections did not come up as expected. Investigating the logs on the nodes I discovered that the following was logged at one point by "confignetwork" postscript:

[I]: create bridge connection xcat-bridge-brexternalnet
[I]: nmcli con add type bridge con-name xcat-bridge-brexternalnet ifname brexternalnet connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-retries 0 connection.autoconnect-slaves 1
Connection 'xcat-bridge-brexternalnet' (87408de7-da96-4214-811b-9a57234cf092) successfully added.
[I]: create ethernet slaves connetcion Wired connection 2 for bridge
[I]: nmcli con mod Wired connection 2 master brexternalnet  connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-slaves 1 connection.autoconnect-retries 0
Error: unknown connection 'Wired'.
[E]:Error: nmcli failed to add bridge slave ens4f0
[E]:Error: create bridge interface brexternalnet failed

The automatic generated connection name in my case was Wired connection 2, which causes problems when the actual nmcli is executed.

After a long trial and error session I decided to replace the connection name with the uuid of the connection, as this should not contain spaces:

--- nicutils.sh.orig
+++ nicutils.sh
@@ -2035,7 +2021,9 @@
         fi
         con_use_same_dev=$(wait_nic_connect_intime $_port)
         if [ "$con_use_same_dev" != "--" -a -n "$con_use_same_dev" ]; then
-            cmd="$nmcli con mod "$con_use_same_dev" master $ifname $_mtu connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-slaves 1 connection.autoconnect-retries 0"
+            log_info "$con_use_same_dev may contain white spaces, therefore replacing it with the UUID"
+            con_use_same_dev=$( $nmcli --get-values connection.uuid c show "$con_use_same_dev" )
+            cmd="$nmcli con mod $con_use_same_dev master $ifname $_mtu connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-slaves 1 connection.autoconnect-retries 0"
             xcat_slave_con=$con_use_same_dev
         else
             cmd="$nmcli con add type $_pretype con-name $xcat_slave_con ifname $_port master $ifname $_mtu connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-slaves 1 connection.autoconnect-retries 0"

Maybe someone can implement this or find a better solution on how to deal with white spaces. (Maybe by placing cmd in single quotes?)

Version information:

$ dnf info xCAT.x86_64
Name         : xCAT
Version      : 2.16.5
Release      : snap202303030907
Architecture : x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant