Fix nova scheduler down after first docker restart

Due to a Docker bug [1] we cannot use Docker to send
SIGHUP to the container because it will mark it as
stopped.
This patch sends the signal directly to the process,
bypassing Docker.

'changed_when: false' is also removed from the
relevant task as it definitely changes the state.
In the future we could do the refresh only if
there really is a need for another one.

[1] https://github.com/moby/moby/issues/11065

Change-Id: Ief73bbd24568d6941384ea3330ab45f11aa42d37
Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Closes-Bug: #1845244
This commit is contained in:
Mark Goddard 2019-10-24 15:01:42 +01:00 committed by Radosław Piliszek
parent 160af32c2c
commit 6bdf202658

View File

@ -3,7 +3,10 @@
# in nova scheduler.
- name: Refresh cell cache in nova scheduler
become: true
command: docker kill --signal HUP nova_scheduler
changed_when: False
# NOTE(yoctozepto): Normally we would send the signal via Docker but, due to a
# Docker bug (https://github.com/moby/moby/issues/11065), this might cause the
# container to be stopped if we restart Docker or reboot the server as we
# use the 'unless-stopped' restart policy by default.
shell: "kill -HUP `docker inspect -f '{% raw %}{{.State.Pid}}{% endraw %}' nova_scheduler`"
when:
- inventory_hostname in groups['nova-scheduler']