Store inspector ramdisk logs by default

They have not been stored previously because the logs collector was not
enabled. Also use the standard location for logs and save them in the CI.

Change-Id: I034a5fffb982a848ceda3db6635da841f869111e
This commit is contained in:
Dmitry Tantsur 2020-07-24 16:08:36 +02:00
parent 92ec342ce1
commit 1606aad1a4
6 changed files with 27 additions and 25 deletions

View File

@ -198,10 +198,6 @@ inspector_manage_firewall: Boolean value, default false. Controls whether
adds the rule to permit the callback traffic, adds the rule to permit the callback traffic,
so you shouldn't need to enable this. so you shouldn't need to enable this.
inspector_data_dir: Base path for ironic-inspector's temporary data and log
files. The default location is
`/opt/stack/ironic-inspector/var`.
inspector_port_addition: Defines which MAC addresses to add as ports during inspector_port_addition: Defines which MAC addresses to add as ports during
introspection. Possible values are `all`, `active`, introspection. Possible values are `all`, `active`,
and `pxe`. The default value is `pxe`. and `pxe`. The default value is `pxe`.

View File

@ -199,11 +199,11 @@ ironic_log_dir: /var/log/ironic
# Set inspector_log_dir to use a non-default log directory for inspector. # Set inspector_log_dir to use a non-default log directory for inspector.
#inspector_log_dir: #inspector_log_dir:
inspector_ramdisk_logs_local_path: /var/log/ironic-inspector/ramdisk
# Set nginx_log_dir to use a non-default log directory for nginx. # Set nginx_log_dir to use a non-default log directory for nginx.
nginx_log_dir: /var/log/nginx nginx_log_dir: /var/log/nginx
inspector_data_dir: "/opt/stack/ironic-inspector/var"
inspector_store_ramdisk_logs: true inspector_store_ramdisk_logs: true
# Note: inspector_port_addition has three valid values: all, active, pxe # Note: inspector_port_addition has three valid values: all, active, pxe
inspector_port_addition: "pxe" inspector_port_addition: "pxe"
@ -213,7 +213,7 @@ inspector_keep_ports: "present"
# String value containing extra kernel parameters for the inspector default # String value containing extra kernel parameters for the inspector default
# PXE configuration. # PXE configuration.
#inspector_extra_kernel_options: inspector_extra_kernel_options: "ipa-inspection-collectors=default,logs"
# Set inspector_processing_hooks to specify a non-default comma-separated # Set inspector_processing_hooks to specify a non-default comma-separated
# list of processing hooks for inspector. # list of processing hooks for inspector.

View File

@ -72,20 +72,17 @@
owner=ironic owner=ironic
group=ironic group=ironic
mode=0740 mode=0740
- name: "Inspector - create data folder" - name: "Inspector - Create the log directories (if requested)"
file: file:
name="{{ inspector_data_dir }}" name: "{{ item }}"
state=directory state: directory
owner=ironic owner: ironic
group=ironic group: ironic
mode=0755 mode: 0700
- name: "Inspector - create log folder" loop:
file: - "{{ inspector_log_dir | default('') }}"
name="{{ inspector_data_dir }}/log" - "{{ inspector_ramdisk_logs_local_path | default('') }}"
state=directory when: item != ""
owner=ironic
group=ironic
mode=0755
- name: "Upgrade inspector DB Schema" - name: "Upgrade inspector DB Schema"
shell: ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade shell: ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade
become: true become: true

View File

@ -8,7 +8,7 @@ auth_strategy = noauth
{% endif %} {% endif %}
debug = {{ inspector_debug | bool }} debug = {{ inspector_debug | bool }}
{% if inspector_log_dir is defined %} {% if inspector_log_dir | default("") != "" %}
log_dir = {{ inspector_log_dir }} log_dir = {{ inspector_log_dir }}
{% endif %} {% endif %}
@ -59,7 +59,9 @@ project_domain_id = default
[processing] [processing]
add_ports = {{ inspector_port_addition | default('pxe') }} add_ports = {{ inspector_port_addition | default('pxe') }}
keep_ports = {{ inspector_keep_ports | default('present') }} keep_ports = {{ inspector_keep_ports | default('present') }}
ramdisk_logs_dir = {{ inspector_data_dir }}/log {% if inspector_ramdisk_logs_local_path | default("") != "" %}
ramdisk_logs_dir = {{ inspector_ramdisk_logs_local_path }}
{% endif %}
always_store_ramdisk_logs = {{ inspector_store_ramdisk_logs | default('true') | bool }} always_store_ramdisk_logs = {{ inspector_store_ramdisk_logs | default('true') | bool }}
{% if inspector_processing_hooks is defined %} {% if inspector_processing_hooks is defined %}
processing_hooks = {{ inspector_processing_hooks }} processing_hooks = {{ inspector_processing_hooks }}

View File

@ -0,0 +1,9 @@
---
features:
- |
The ramdisk logs for inspection are now stored by default in
``/var/log/ironic-inspector/ramdisk``.
security:
- |
Uses mode 0700 for the inspector log directories to prevent them from being
world readable.

View File

@ -81,10 +81,8 @@ for vm in $(baremetal node list -c Name -f value); do
baremetal node show $vm >> ${LOG_LOCATION}/baremetal.txt baremetal node show $vm >> ${LOG_LOCATION}/baremetal.txt
done done
if [ -d "/var/log/ironic" ]; then sudo cp -a "/var/log/ironic/deploy" ${LOG_LOCATION}/deploy-ramdisk
sudo cp -a "/var/log/ironic" ${LOG_LOCATION}/ipa-logs sudo cp -a "/var/log/ironic-inspector/ramdisk" ${LOG_LOCATION}/inspection-ramdisk
ls -la ${LOG_LOCATION}/ipa-logs
fi
# general info # general info
sudo ps auxf &> ${LOG_LOCATION}/ps.txt sudo ps auxf &> ${LOG_LOCATION}/ps.txt