diff --git a/playbooks/kayobe-overcloud-upgrade-base/post.yml b/playbooks/kayobe-overcloud-upgrade-base/post.yml index 31dccb283..be286660b 100644 --- a/playbooks/kayobe-overcloud-upgrade-base/post.yml +++ b/playbooks/kayobe-overcloud-upgrade-base/post.yml @@ -5,4 +5,5 @@ kayobe_diagnostics_phase: "post" 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_previous_config_dir: "{{ ansible_env.PWD ~ '/previous/kayobe-config' }}" kayobe_diagnostics_executor_log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}" diff --git a/roles/kayobe-diagnostics/defaults/main.yml b/roles/kayobe-diagnostics/defaults/main.yml index 57a6b6ce2..fe3f88d2f 100644 --- a/roles/kayobe-diagnostics/defaults/main.yml +++ b/roles/kayobe-diagnostics/defaults/main.yml @@ -8,5 +8,9 @@ kayobe_diagnostics_logs_dir: # Directory on the remote host in which configuration is stored. 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. kayobe_diagnostics_executor_log_dir: diff --git a/roles/kayobe-diagnostics/files/get_logs.sh b/roles/kayobe-diagnostics/files/get_logs.sh index a5916c37d..a9765d356 100644 --- a/roles/kayobe-diagnostics/files/get_logs.sh +++ b/roles/kayobe-diagnostics/files/get_logs.sh @@ -6,6 +6,8 @@ # Environment variables: # $LOG_DIR is the directory to copy logs to. # $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 @@ -19,6 +21,16 @@ copy_logs() { rm ${LOG_DIR}/kayobe_configs/kolla/config/ironic/ironic-agent.{kernel,initramfs} rm ${LOG_DIR}/kolla_configs/config/ironic/ironic-agent.{kernel,initramfs} 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/ diff --git a/roles/kayobe-diagnostics/tasks/post.yml b/roles/kayobe-diagnostics/tasks/post.yml index 25efaa289..c5252418e 100644 --- a/roles/kayobe-diagnostics/tasks/post.yml +++ b/roles/kayobe-diagnostics/tasks/post.yml @@ -12,6 +12,7 @@ environment: LOG_DIR: "{{ kayobe_diagnostics_log_dir }}" CONFIG_DIR: "{{ kayobe_diagnostics_config_dir }}" + PREVIOUS_CONFIG_DIR: "{{ kayobe_diagnostics_previous_config_dir }}" - name: Print get_logs.sh output debug: