From 9ae3c52104a2098b2566fe77e5420ec93b5875f7 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Thu, 31 Jul 2014 15:01:09 -0400 Subject: [PATCH] Use pacemaker to run neutron l3 agent and metadata agent Currently l3-agent and metadata agent can not run in a/a mode without loosing data if a node goes down. This patch sets a/p mode for both services. Note that this is a short-term solution of providing HA for the services. Other temporary solutions like running l3-agent in a/a mode and re-assign routers when a node goes down, might work better but implementation would be much more complex and it would be still just a temporary solution until l3-agent supports a/a HA (which is planned for Juno). Relies on: Icc97e36a1db198b973041346cf2056f68de661a2 Change-Id: I63f054a8c80f9f676a77341c89e605b5b472d078 --- elements/neutron-network-node/element-deps | 2 ++ .../post-configure.d/80-neutron-networking | 36 ++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/elements/neutron-network-node/element-deps b/elements/neutron-network-node/element-deps index 9a31439c8..eaf3f20b9 100644 --- a/elements/neutron-network-node/element-deps +++ b/elements/neutron-network-node/element-deps @@ -1,4 +1,6 @@ neutron neutron-dhcp-agent neutron-openvswitch-agent +os-is-bootstrap-host os-refresh-config +pacemaker diff --git a/elements/neutron-network-node/os-refresh-config/post-configure.d/80-neutron-networking b/elements/neutron-network-node/os-refresh-config/post-configure.d/80-neutron-networking index acbbf553a..5e0e3ce4f 100755 --- a/elements/neutron-network-node/os-refresh-config/post-configure.d/80-neutron-networking +++ b/elements/neutron-network-node/os-refresh-config/post-configure.d/80-neutron-networking @@ -1,8 +1,36 @@ #!/bin/bash set -eux -os-svc-enable -n neutron-metadata-agent -os-svc-enable -n neutron-l3-agent +# get resource class (systemd, upstart, lsb). It should be possible +# to use 'service' class which is a wrapper for others but this doesn't work +# as expected on Fedora - lrmd process segfaults if 'service' resource class +# is used: https://bugzilla.redhat.com/show_bug.cgi?id=1117151 +CLASS=$(dib-init-system) +if [ "$CLASS" = "sysv" ]; then + CLASS=lsb +fi -os-svc-restart -n neutron-metadata-agent -os-svc-restart -n neutron-l3-agent +if os-is-bootstrap-host; then + SERVICE_METADATA=$(map-services neutron-metadata-agent) + SERVICE_AGENT=$(map-services neutron-l3-agent) + + if ! cibadmin --query --xpath "//primitive[@id=\"$SERVICE_METADATA\"]"; then + /usr/sbin/cibadmin -o resources -C -X " + + + + + +" + fi + + if ! cibadmin --query --xpath "//primitive[@id=\"$SERVICE_AGENT\"]"; then + /usr/sbin/cibadmin -o resources -C -X " + + + + + +" + fi +fi