Run tcpdump separately from introspection

There are various issues with stopping tcpdump in shell script
in background so it won't affect other commands. Also for
moving to operators we need to separate these steps.
Run tcpdump in a different task.

Closes-Bug: #1880851

Change-Id: I38dc2a53c6bb56eaa916e84798dcd3c0fac3fa1a
This commit is contained in:
Sagi Shnaidman 2020-06-10 14:18:39 +03:00
parent 026f0f80a1
commit daa2b6be47
2 changed files with 21 additions and 14 deletions
roles/overcloud-prep-images

@ -74,6 +74,21 @@
changed_when: true
when: step_root_device_hints|bool
- name: Run tcpdump during introspection in background
become: true
shell: >
{{ ansible_pkg_mgr }} -y install tcpdump;
tcpdump -U -i any port {{ step_introspect_debug_tcpdump_ports | join(' or port ') }}
-w {{ step_introspect_debug_tcpdump_log }} > /dev/null &
args:
executable: /bin/bash
async: 1
poll: 0
changed_when: false
when:
- step_introspect|bool
- step_introspect_debug|bool
- name: Introspect overcloud images
shell: >
set -o pipefail &&
@ -82,6 +97,12 @@
changed_when: true
when: step_introspect|bool
- name: Stop tcpdump after introspection
become: true
command: pkill tcpdump
changed_when: false
failed_when: false
- name: Inject ARA into mistral executor container image
shell: >
set -o pipefail &&

@ -8,15 +8,6 @@ set -eux
source {{ working_dir }}/stackrc
{% if step_introspect_debug|bool %}
sudo {{ ansible_pkg_mgr }} -y install tcpdump
sudo tcpdump -i any port {{ step_introspect_debug_tcpdump_ports | join(' or port ') }} -w {{ step_introspect_debug_tcpdump_log }} &
sleep 1
pidof_tcpdump=$(ps --ppid $! -o pid=)
{% endif %}
## * Introspect hardware attributes of nodes.
## ::
openstack overcloud node introspect --all-manageable
@ -76,9 +67,4 @@ introspect 60m
{% endif %}
{% if step_introspect_debug|bool %}
sudo kill $pidof_tcpdump
{% endif %}
### --stop_docs