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 <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-06-30 11:31:49 -05:00 committed by Jesse Pretorius (odyssey4me)
parent 3344d7566c
commit 86fc72bd69
2 changed files with 26 additions and 0 deletions

View File

@ -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

View File

@ -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.