From 9a3c1cd20aa20f23cc94c259d35f18ab2e46e6f8 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Fri, 10 Jan 2014 15:36:29 -0500 Subject: [PATCH] Add new neutron-ovs-cleanup element. This patch adds a new neutron-ovs-cleanup element which configures the neutron-ovs-cleanup service to run so that it cleans up *all* OVS ports. We want to do this at a very specific time in the boot process so that DHCP on reboot works properly: 1) after OVS is available (nonetworking) 2) before networking is started NOTE: This service is not started on first boot but will run on any subsequent reboots (it is enabled in os-refresh-config) Without this fix networking after rebooting an overcloud instance is a total failure due to the fact that the physical NIC has been moved to an OVS bridge by init-neutron-ovs and DHCP requests fail. The currently patch implements this on systemd only. In addition to all the above, cleaning up old neutron ports is a good idea on reboot anyways. So we get that for free here too. Change-Id: Ic87f2388680ec4f67b6275b8d923f76b75559c78 Closes-bug: 1254533 --- elements/neutron-ovs-cleanup/README.md | 7 +++++++ elements/neutron-ovs-cleanup/element-deps | 1 + .../install.d/81-neutron-ovs-cleanup | 9 +++++++++ .../install.d/neutron-ovs-cleanup.service | 15 +++++++++++++++ .../post-configure.d/81-neutron-ovs-cleanup | 4 ++++ 5 files changed, 36 insertions(+) create mode 100644 elements/neutron-ovs-cleanup/README.md create mode 100644 elements/neutron-ovs-cleanup/element-deps create mode 100755 elements/neutron-ovs-cleanup/install.d/81-neutron-ovs-cleanup create mode 100644 elements/neutron-ovs-cleanup/install.d/neutron-ovs-cleanup.service create mode 100755 elements/neutron-ovs-cleanup/os-refresh-config/post-configure.d/81-neutron-ovs-cleanup 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