From 86fc72bd69b8c5dc4ba35919e4302b04d95cea1f Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 30 Jun 2016 11:31:49 -0500 Subject: [PATCH] Cleanup metadata-proxy when old versions are present The metadata proxy service will now be cleaned up when this role is executed if an old version of the metadata-proxy is still running. Once the old versions of the metadata-proxy have been cleaned up the metadata agent will respawn the correct process within 60 seconds. This change is required to ensure upgrades are always executing the correct code from a given release. Change-Id: I3a0b5c5b75742f06a94e5334c749b88e54f7f43c Signed-off-by: Kevin Carter --- handlers/main.yml | 16 ++++++++++++++++ .../metadata-proxy-cleanup-eed6ff482035dc83.yaml | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 releasenotes/notes/metadata-proxy-cleanup-eed6ff482035dc83.yaml diff --git a/handlers/main.yml b/handlers/main.yml index c796fc58..3bacc48b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -20,4 +20,20 @@ pattern: "{{ item.value.service_name }}" with_dict: "{{ neutron_services }}" failed_when: false + notify: + - Run ns-metadata-proxy process cleanup when: item.value.service_en | bool + +# NOTE(cloudnull): +# When installing or upgrading it is possible that an old metadata proxy process will not +# be restarted by the metadata agent when a version changes. To fix it the ns-metadata +# proxy pids are killed if they're not running the current tag. Once the old processeses +# are removed the metadata agent will respawn the missing process within 60 seconds using +# the correct code. +- name: Run ns-metadata-proxy process cleanup + shell: | + for ns_pid in $(pgrep neutron-ns-meta); do + (echo $(readlink -f "/proc/$ns_pid/exe") | grep -qv "{{ neutron_venv_tag }}") && \ + (echo "old metadata proxy pid found running clean up on $ns_pid"; kill -9 "$ns_pid") + done + when: neutron_services['neutron-metadata-agent'].service_en | bool diff --git a/releasenotes/notes/metadata-proxy-cleanup-eed6ff482035dc83.yaml b/releasenotes/notes/metadata-proxy-cleanup-eed6ff482035dc83.yaml new file mode 100644 index 00000000..74ec7cb9 --- /dev/null +++ b/releasenotes/notes/metadata-proxy-cleanup-eed6ff482035dc83.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - When upgrading it is possible for an old "neutron-ns-metadata-proxy" + process to remain running in memory. If this happens the old version of + the process can cause unexpected issues in a production environment. To + fix this a task has been added to the os_neutron role that will execute + a process lookup and kill any "neutron-ns-metadata-proxy" processes that + are not running the current release tag. Once the old processes are + removed the metadata agent running will respawn everything needed within + 60 seconds.