diff --git a/elements/neutron-ovs-cleanup/README.md b/elements/neutron-ovs-cleanup/README.md new file mode 100644 index 000000000..015bc4fc8 --- /dev/null +++ b/elements/neutron-ovs-cleanup/README.md @@ -0,0 +1,7 @@ +Install and configure OpenStack Networking cleanup utility. + +We use this utility to cleanup all OVS ports on reboot. This helps fix +a race condition where DHCP on reboot fails due to the fact that +Openvswitch starts after networking on most distros. + +Currently supports systemd distributions only. diff --git a/elements/neutron-ovs-cleanup/element-deps b/elements/neutron-ovs-cleanup/element-deps new file mode 100644 index 000000000..99d73a448 --- /dev/null +++ b/elements/neutron-ovs-cleanup/element-deps @@ -0,0 +1 @@ +neutron diff --git a/elements/neutron-ovs-cleanup/install.d/81-neutron-ovs-cleanup b/elements/neutron-ovs-cleanup/install.d/81-neutron-ovs-cleanup new file mode 100755 index 000000000..b5383f5d4 --- /dev/null +++ b/elements/neutron-ovs-cleanup/install.d/81-neutron-ovs-cleanup @@ -0,0 +1,9 @@ +#!/bin/bash +set -x + +SCRIPTDIR=$(dirname $0) + +DIB_INIT_SYSTEM=$(dib-init-system) +if [ "$DIB_INIT_SYSTEM" == "systemd" ]; then + install -D -g root -o root -m 0755 ${SCRIPTDIR}/neutron-ovs-cleanup.service /usr/lib/systemd/system/neutron-ovs-cleanup.service +fi diff --git a/elements/neutron-ovs-cleanup/install.d/neutron-ovs-cleanup.service b/elements/neutron-ovs-cleanup/install.d/neutron-ovs-cleanup.service new file mode 100644 index 000000000..7d58b2ee8 --- /dev/null +++ b/elements/neutron-ovs-cleanup/install.d/neutron-ovs-cleanup.service @@ -0,0 +1,15 @@ +[Unit] +Description=Neutron OVS Cleanup Service +Wants=network.service openvswitch-nonetwork.service +After=openvswitch-nonetwork.service +Before=network.service + +[Service] +Type=oneshot +ExecStart=/opt/stack/venvs/neutron/bin/neutron-ovs-cleanup --ovs_all_ports +User=root +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target +Alias=neutron-ovs-cleanup.service diff --git a/elements/neutron-ovs-cleanup/os-refresh-config/post-configure.d/81-neutron-ovs-cleanup b/elements/neutron-ovs-cleanup/os-refresh-config/post-configure.d/81-neutron-ovs-cleanup new file mode 100755 index 000000000..e0592f4a6 --- /dev/null +++ b/elements/neutron-ovs-cleanup/os-refresh-config/post-configure.d/81-neutron-ovs-cleanup @@ -0,0 +1,4 @@ +#!/bin/bash +set -eux + +os-svc-enable -n neutron-ovs-cleanup