Skip to content

Commit 1ed276c

Browse files
committed
Use (or set properly) system-id generated by openvswitch
In case when OVN_UUID isn't set by user, and it isn't stored in /etc/openvswith/system-id.conf file, Devstack will reuse it. If it's not, it will generate and store it in the /etc/openvswitch/system-id.conf file so it can be set to same value after openvswitch will be e.g. restarted. In case when OVN_UUID is set by user, it will be also saved in /etc/openvswitch/system-id.conf file to make it persistent when e.g openvswitch will be restarted. Closes-Bug: #1918656 Change-Id: I8e3b05f3ab83e204bc1ce895baec0e1ba515895b
1 parent ff895cc commit 1ed276c

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

lib/neutron_plugins/ovn_agent

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ OVN_L3_SCHEDULER=${OVN_L3_SCHEDULER:-leastloaded}
6666

6767
# A UUID to uniquely identify this system. If one is not specified, a random
6868
# one will be generated. A randomly generated UUID will be saved in a file
69-
# 'ovn-uuid' so that the same one will be re-used if you re-run DevStack.
69+
# $OVS_SYSCONFDIR/system-id.conf (typically /etc/openvswitch/system-id.conf)
70+
# so that the same one will be re-used if you re-run DevStack or restart
71+
# Open vSwitch service.
7072
OVN_UUID=${OVN_UUID:-}
7173

7274
# Whether or not to build the openvswitch kernel module from ovs. This is required
@@ -109,6 +111,7 @@ OVS_RUNDIR=$OVS_PREFIX/var/run/openvswitch
109111
OVS_SHAREDIR=$OVS_PREFIX/share/openvswitch
110112
OVS_SCRIPTDIR=$OVS_SHAREDIR/scripts
111113
OVS_DATADIR=$DATA_DIR/ovs
114+
OVS_SYSCONFDIR=${OVS_SYSCONFDIR:-/etc/openvswitch}
112115

113116
OVN_DATADIR=$DATA_DIR/ovn
114117
OVN_SHAREDIR=$OVS_PREFIX/share/ovn
@@ -521,11 +524,17 @@ function configure_ovn {
521524
echo "Configuring OVN"
522525

523526
if [ -z "$OVN_UUID" ] ; then
524-
if [ -f ./ovn-uuid ] ; then
525-
OVN_UUID=$(cat ovn-uuid)
527+
if [ -f $OVS_SYSCONFDIR/system-id.conf ]; then
528+
OVN_UUID=$(cat $OVS_SYSCONFDIR/system-id.conf)
526529
else
527530
OVN_UUID=$(uuidgen)
528-
echo $OVN_UUID > ovn-uuid
531+
echo $OVN_UUID | sudo tee $OVS_SYSCONFDIR/system-id.conf
532+
fi
533+
else
534+
local ovs_uuid
535+
ovs_uuid=$(cat $OVS_SYSCONFDIR/system-id.conf)
536+
if [ "$ovs_uuid" != $OVN_UUID ]; then
537+
echo $OVN_UUID | sudo tee $OVS_SYSCONFDIR/system-id.conf
529538
fi
530539
fi
531540

0 commit comments

Comments
 (0)