ovs: Fix OVS path mismatch when building from source with OVN
``compile_ovs`` was called with ``--localstatedir=/var``, causing
all compiled OVS binaries to hardcode ``/var/run/openvswitch`` as
the default runtime directory. However, the ``ovn_agent`` plugin
derives ``OVS_RUNDIR`` from ``OVS_PREFIX`` as
``/usr/local/var/run/openvswitch``, creating a path mismatch that
makes ``ovs-vsctl`` unable to reach the running ``ovsdb-server``.
Additionally, ``start_new_ovs`` was unconditionally starting OVS
during the install phase. When OVN is the backend,
``ovn_agent:_start_ovs`` later starts its own OVS instance with a
separate database, but the orphaned ``ovs-vswitchd`` from
``start_new_ovs`` still holds the kernel datapath, preventing
bridge creation.
Fix both issues:
- Remove the ``--localstatedir=/var`` override so the compiled
default matches ``OVS_RUNDIR`` (autotools defaults localstatedir
to ``${prefix}/var``).
- Skip ``start_new_ovs`` when OVN services are enabled, since
``_start_ovs`` handles the full OVS lifecycle.
- Fix the hardcoded DB path in ``start_new_ovs`` to match the
compiled ``--prefix=/usr/local`` sysconfdir.
Closes-Bug: #2158954
Assisted-By: Claude Opus 4.6
Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
Change-Id: I8f3a2c5e7d1b4a9f6e0c3d8b2a5f7e1d4c6b9a0e
This commit is contained in:
1 parent
70c041f272
commit
9b0a00865c
2 files changed
+10
-3
No files matched your search
@@ -68,9 +68,15 @@ function _neutron_ovs_base_install_ubuntu_dkms {
|
||||
function _neutron_ovs_base_install_agent_packages {
|
||||
if [ "$Q_BUILD_OVS_FROM_GIT" == "True" ]; then
|
||||
remove_ovs_packages
|
||||
compile_ovs /usr/local /var
|
||||
compile_ovs /usr/local
|
||||
load_conntrack_gre_module
|
||||
start_new_ovs
|
||||
# When OVN is the backend, ovn_agent:_start_ovs handles OVS
|
||||
# lifecycle with its own DB and rundir. Starting OVS here would
|
||||
# leave an orphaned ovs-vswitchd holding the kernel datapath,
|
||||
# preventing the OVN-managed instance from creating bridges.
|
||||
if ! is_service_enabled ovn-controller ovn-northd; then
|
||||
start_new_ovs
|
||||
fi
|
||||
else
|
||||
# Install deps
|
||||
install_package $(get_packages "openvswitch")
|
||||
|
||||
@@ -128,7 +128,8 @@ function action_openvswitch {
|
||||
|
||||
# start_new_ovs() - removes old ovs database, creates a new one and starts ovs
|
||||
function start_new_ovs {
|
||||
sudo rm -f /etc/openvswitch/conf.db /etc/openvswitch/.conf.db~lock~
|
||||
# DB path must match the compiled --prefix=/usr/local sysconfdir
|
||||
sudo rm -f /usr/local/etc/openvswitch/conf.db /usr/local/etc/openvswitch/.conf.db~lock~
|
||||
sudo /usr/local/share/openvswitch/scripts/ovs-ctl start
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user