diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index 4facfdc99f..efe360cda7 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -117,15 +117,15 @@ function migrate_ip_from_nic { if [[ -n "${ip}" && -n "${prefix}" ]]; then ip addr flush dev ${src_nic} if [ $? -ne 0 ] ; then - ip addr add ${ip}/${prefix} dev ${src_nic} + ip addr replace ${ip}/${prefix} dev ${src_nic} echo "Error while flushing IP from ${src_nic}." exit 1 fi - ip addr add ${ip}/${prefix} dev "${bridge_name}" + ip addr replace ${ip}/${prefix} dev "${bridge_name}" if [ $? -ne 0 ] ; then echo "Error assigning IP to bridge "${bridge_name}"." - ip addr add ${ip}/${prefix} dev ${src_nic} + ip addr replace ${ip}/${prefix} dev ${src_nic} exit 1 fi elif [[ -n "${bridge_ip}" && -n "${bridge_prefix}" ]]; then diff --git a/ovn/templates/bin/_ovn-controller-init.sh.tpl b/ovn/templates/bin/_ovn-controller-init.sh.tpl index 13fed73a77..648e7dd404 100644 --- a/ovn/templates/bin/_ovn-controller-init.sh.tpl +++ b/ovn/templates/bin/_ovn-controller-init.sh.tpl @@ -54,15 +54,15 @@ function migrate_ip_from_nic { if [[ -n "${ip}" && -n "${prefix}" ]]; then ip addr flush dev ${src_nic} if [ $? -ne 0 ] ; then - ip addr add ${ip}/${prefix} dev ${src_nic} + ip addr replace ${ip}/${prefix} dev ${src_nic} echo "Error while flushing IP from ${src_nic}." exit 1 fi - ip addr add ${ip}/${prefix} dev "${bridge_name}" + ip addr replace ${ip}/${prefix} dev "${bridge_name}" if [ $? -ne 0 ] ; then echo "Error assigning IP to bridge "${bridge_name}"." - ip addr add ${ip}/${prefix} dev ${src_nic} + ip addr replace ${ip}/${prefix} dev ${src_nic} exit 1 fi elif [[ -n "${bridge_ip}" && -n "${bridge_prefix}" ]]; then diff --git a/releasenotes/notes/neutron-2af36e49a0a377c3.yaml b/releasenotes/notes/neutron-2af36e49a0a377c3.yaml new file mode 100644 index 0000000000..c59120bf77 --- /dev/null +++ b/releasenotes/notes/neutron-2af36e49a0a377c3.yaml @@ -0,0 +1,13 @@ +--- +# To create a new release note related to a specific chart: +# reno new +# +# To create a new release note for a common change (when multiple charts +# are changed): +# reno new common +neutron: + - | + Use `ip add replace` instead of `ip addr add` in the init script to + make it idempotent and avoid errors when the script tries to assign + the same IP address to the interface on subsequent runs. +... diff --git a/releasenotes/notes/ovn-ffd84bb8c9e73b64.yaml b/releasenotes/notes/ovn-ffd84bb8c9e73b64.yaml new file mode 100644 index 0000000000..570ba51ddf --- /dev/null +++ b/releasenotes/notes/ovn-ffd84bb8c9e73b64.yaml @@ -0,0 +1,13 @@ +--- +# To create a new release note related to a specific chart: +# reno new +# +# To create a new release note for a common change (when multiple charts +# are changed): +# reno new common +ovn: + - | + Use `ip add replace` instead of `ip addr add` in the init script to + make it idempotent and avoid errors when the script tries to assign + the same IP address to the interface on subsequent runs. +...