Settings are not changed correctly due to nmcli race condition
When running nmcli in parallel, the settings are not changed correctly.
Reproducer is as follows:
================
~]# cat a.sh
#!/bin/bash
nmcli c mod ens7 +ipv4.addresses "192.168.122.201/24"
nmcli c mod ens7 -ipv4.addresses "192.168.122.201/24"
~]#
~]# cat b.sh
#!/bin/bash
nmcli c mod ens7 +ipv4.addresses "192.168.122.202/24"
nmcli c mod ens7 -ipv4.addresses "192.168.122.202/24"
~]#
~]# ./a.sh & ./b.sh & wait ; nmcli c show ens7 | grep ipv4.addresses
[1] 239826
[2] 239827
ipv4.addresses: 192.168.122.250/24, 192.168.122.201/24 <== Not deleted
================
When running the nmcli c mod, nmcli executes the following sequence.
================
nmcli NetworkManager
-- GetSettings -->
<-----------------
-- Update ------->
<-----------------
================
GetSettings response and Update request are not atomic.
In the meantime, another nmcli process interrupted, causing this issue.
I think that nmcli should be mutually excluded by file locking etc.