Save previous kayobe & kolla configuration

In the upgrade CI job, the kayobe configuration is first generated for
the previous release. If the job fails while deploying the previous
release, we don't have access to the configuration that was used.

This change adds previous_kayobe_config and previous_kolla_config to the
saved logs.

Change-Id: I603fc856cf79bdc52f5bf158c6706c1c0ffe2d95
This commit is contained in:
Mark Goddard 2018-11-08 14:34:42 +00:00
parent d0e9c50fd2
commit 486cda26d8
4 changed files with 18 additions and 0 deletions

View File

@ -5,4 +5,5 @@
kayobe_diagnostics_phase: "post" kayobe_diagnostics_phase: "post"
kayobe_diagnostics_log_dir: "/tmp/logs" kayobe_diagnostics_log_dir: "/tmp/logs"
kayobe_diagnostics_config_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['git.openstack.org/openstack/kayobe-config-dev'].src_dir }}" kayobe_diagnostics_config_dir: "{{ ansible_env.PWD ~ '/' ~ zuul.projects['git.openstack.org/openstack/kayobe-config-dev'].src_dir }}"
kayobe_diagnostics_previous_config_dir: "{{ ansible_env.PWD ~ '/previous/kayobe-config' }}"
kayobe_diagnostics_executor_log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}" kayobe_diagnostics_executor_log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"

View File

@ -8,5 +8,9 @@ kayobe_diagnostics_logs_dir:
# Directory on the remote host in which configuration is stored. # Directory on the remote host in which configuration is stored.
kayobe_diagnostics_config_dir: kayobe_diagnostics_config_dir:
# Directory on the remote host in which configuration for the previous release,
# prior to an upgrade, is stored.
kayobe_diagnostics_previous_config_dir:
# Directory on the executor in which to save logs. # Directory on the executor in which to save logs.
kayobe_diagnostics_executor_log_dir: kayobe_diagnostics_executor_log_dir:

View File

@ -6,6 +6,8 @@
# Environment variables: # Environment variables:
# $LOG_DIR is the directory to copy logs to. # $LOG_DIR is the directory to copy logs to.
# $CONFIG_DIR is the directory to copy configuration from. # $CONFIG_DIR is the directory to copy configuration from.
# $PREVIOUS_CONFIG_DIR is the directory to copy previous configuration, prior
# to an upgrade, from.
set +o errexit set +o errexit
@ -19,6 +21,16 @@ copy_logs() {
rm ${LOG_DIR}/kayobe_configs/kolla/config/ironic/ironic-agent.{kernel,initramfs} rm ${LOG_DIR}/kayobe_configs/kolla/config/ironic/ironic-agent.{kernel,initramfs}
rm ${LOG_DIR}/kolla_configs/config/ironic/ironic-agent.{kernel,initramfs} rm ${LOG_DIR}/kolla_configs/config/ironic/ironic-agent.{kernel,initramfs}
fi fi
if [[ -n ${PREVIOUS_CONFIG_DIR} ]] && [[ -d ${PREVIOUS_CONFIG_DIR} ]]; then
mkdir -p ${LOG_DIR}/previous_{kayobe,kolla}_configs
cp -rnL ${PREVIOUS_CONFIG_DIR}/etc/kayobe/* ${LOG_DIR}/previous_kayobe_configs
cp -rnL ${PREVIOUS_CONFIG_DIR}/etc/kolla/* ${LOG_DIR}/previous_kolla_configs
# NOTE: we can't save node configs in /etc/kolla for the pervious
# release since they'll have been overwritten at this point.
# Don't save the IPA images.
rm ${LOG_DIR}/previous_kayobe_configs/kolla/config/ironic/ironic-agent.{kernel,initramfs}
rm ${LOG_DIR}/previous_kolla_configs/config/ironic/ironic-agent.{kernel,initramfs}
fi
cp -rvnL /var/log/* ${LOG_DIR}/system_logs/ cp -rvnL /var/log/* ${LOG_DIR}/system_logs/

View File

@ -12,6 +12,7 @@
environment: environment:
LOG_DIR: "{{ kayobe_diagnostics_log_dir }}" LOG_DIR: "{{ kayobe_diagnostics_log_dir }}"
CONFIG_DIR: "{{ kayobe_diagnostics_config_dir }}" CONFIG_DIR: "{{ kayobe_diagnostics_config_dir }}"
PREVIOUS_CONFIG_DIR: "{{ kayobe_diagnostics_previous_config_dir }}"
- name: Print get_logs.sh output - name: Print get_logs.sh output
debug: debug: