Historically we have collected devstack logs under /opt/stack.
Stop doing that and collect them in the stage_dir instead, so that
once the base job logs pull service comes around we are ready for it.
This add the benefit of writing things into a folder which is
already owned by the ansible user (ansible_user_dir), so we don't
run into issue writing there.
A few logs (devstack log, log summary and dstat) use to show up on
logs.o.o. just because they happened to already be in /opt/stack/logs.
With this change they would be lost, so adding them to post.yaml.
Depends-on: I5ad4dfccbc1389da3afc53f3c866d3475e006db6
Change-Id: Ib4be2f5056c0dc2b776de4a0d18b47b12624be92
| ... | ... |
@@ -1,14 +1,24 @@ |
| 1 | 1 |
- hosts: all |
| 2 | 2 |
become: True |
| 3 | 3 |
vars: |
| 4 |
+ devstack_log_dir: "{{ devstack_base_dir|default('/opt/stack') }}/logs/"
|
|
| 4 | 5 |
devstack_conf_dir: "{{ devstack_base_dir|default('/opt/stack') }}/devstack/"
|
| 5 |
- stage_dir: "{{ devstack_base_dir|default('/opt/stack') }}"
|
|
| 6 | 6 |
roles: |
| 7 | 7 |
- export-devstack-journal |
| 8 | 8 |
- role: stage-output |
| 9 | 9 |
zuul_copy_output: |
| 10 | 10 |
{ '{{ devstack_conf_dir }}/local.conf': 'logs',
|
| 11 |
- '{{ devstack_conf_dir }}/.stackenv': 'logs' }
|
|
| 11 |
+ '{{ devstack_conf_dir }}/.stackenv': 'logs' ,
|
|
| 12 |
+ '{{ devstack_log_dir }}/dstat-csv.log': 'logs',
|
|
| 13 |
+ '{{ devstack_log_dir }}/devstacklog.txt': 'logs',
|
|
| 14 |
+ '{{ devstack_log_dir }}/devstacklog.txt.summary': 'logs' }
|
|
| 12 | 15 |
extensions_to_txt: |
| 13 | 16 |
- conf |
| 14 |
- - fetch-devstack-log-dir |
|
| 17 |
+ - log |
|
| 18 |
+ - summary |
|
| 19 |
+ # NOTE(andreaf) We need fetch-devstack-log-dir only as long as the base job |
|
| 20 |
+ # starts pulling logs for us from {{ ansible_user_dir }}/logs.
|
|
| 21 |
+ # Meanwhile we already store things in ansible_user_dir and use |
|
| 22 |
+ # fetch-devstack-log-dir setting devstack_base_dir |
|
| 23 |
+ - role: fetch-devstack-log-dir |
|
| 24 |
+ devstack_base_dir: "{{ ansible_user_dir }}"
|
| 15 | 25 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,12 @@ |
| 0 |
+Prepare apache configs and logs for staging |
|
| 1 |
+ |
|
| 2 |
+Make sure apache config files and log files are available in a linux flavor |
|
| 3 |
+independent location. Note that this relies on hard links, to the staging |
|
| 4 |
+directory must be in the same partition where the logs and configs are. |
|
| 5 |
+ |
|
| 6 |
+**Role Variables** |
|
| 7 |
+ |
|
| 8 |
+.. zuul:rolevar:: stage_dir |
|
| 9 |
+ :default: {{ ansible_user_dir }}
|
|
| 10 |
+ |
|
| 11 |
+ The base stage directory. |
| ... | ... |
@@ -5,11 +5,17 @@ journal format as well as text. Also, export a syslog-style file with |
| 5 | 5 |
kernal and sudo messages. |
| 6 | 6 |
|
| 7 | 7 |
Writes the output to the ``logs/`` subdirectory of |
| 8 |
-``devstack_base_dir``. |
|
| 8 |
+``stage_dir``. |
|
| 9 | 9 |
|
| 10 | 10 |
**Role Variables** |
| 11 | 11 |
|
| 12 | 12 |
.. zuul:rolevar:: devstack_base_dir |
| 13 | 13 |
:default: /opt/stack |
| 14 | 14 |
|
| 15 |
- The devstack base directory. |
|
| 15 |
+ The devstack base directory. This is used to obtain the |
|
| 16 |
+ ``log-start-timestamp.txt``, used to filter the systemd journal. |
|
| 17 |
+ |
|
| 18 |
+.. zuul:rolevar:: stage_dir |
|
| 19 |
+ :default: {{ ansible_user_dir }}
|
|
| 20 |
+ |
|
| 21 |
+ The base stage directory. |
| ... | ... |
@@ -1,3 +1,11 @@ |
| 1 |
+# NOTE(andreaf) This bypasses the stage-output role |
|
| 2 |
+- name: Ensure {{ stage_dir }}/logs exists
|
|
| 3 |
+ become: true |
|
| 4 |
+ file: |
|
| 5 |
+ path: "{{ stage_dir }}/logs"
|
|
| 6 |
+ state: directory |
|
| 7 |
+ owner: "{{ ansible_user }}"
|
|
| 8 |
+ |
|
| 1 | 9 |
# TODO: convert this to ansible |
| 2 | 10 |
- name: Export journal files |
| 3 | 11 |
become: true |
| ... | ... |
@@ -7,7 +15,7 @@ |
| 7 | 7 |
name="" |
| 8 | 8 |
for u in `systemctl list-unit-files | grep devstack | awk '{print $1}'`; do
|
| 9 | 9 |
name=$(echo $u | sed 's/devstack@/screen-/' | sed 's/\.service//') |
| 10 |
- journalctl -o short-precise --unit $u | tee {{ devstack_base_dir }}/logs/$name.txt > /dev/null
|
|
| 10 |
+ journalctl -o short-precise --unit $u | tee {{ stage_dir }}/logs/$name.txt > /dev/null
|
|
| 11 | 11 |
done |
| 12 | 12 |
|
| 13 | 13 |
# Export the journal in export format to make it downloadable |
| ... | ... |
@@ -16,7 +24,7 @@ |
| 16 | 16 |
# debugging much easier. We don't do the native conversion here as |
| 17 | 17 |
# some distros do not package that tooling. |
| 18 | 18 |
journalctl -u 'devstack@*' -o export | \ |
| 19 |
- xz --threads=0 - > {{ devstack_base_dir }}/logs/devstack.journal.xz
|
|
| 19 |
+ xz --threads=0 - > {{ stage_dir }}/logs/devstack.journal.xz
|
|
| 20 | 20 |
|
| 21 | 21 |
# The journal contains everything running under systemd, we'll |
| 22 | 22 |
# build an old school version of the syslog with just the |
| ... | ... |
@@ -26,4 +34,4 @@ |
| 26 | 26 |
-t sudo \ |
| 27 | 27 |
--no-pager \ |
| 28 | 28 |
--since="$(cat {{ devstack_base_dir }}/log-start-timestamp.txt)" \
|
| 29 |
- | tee {{ devstack_base_dir }}/logs/syslog.txt > /dev/null
|
|
| 29 |
+ | tee {{ stage_dir }}/logs/syslog.txt > /dev/null
|