Add debug log for CI tests

When the CI fails, specifically related to the Trove guest agent,
we are unable to find a way to debug it.
this patch synchronizes the guest agent logs to controller nodes.

Change-Id: I24695238075f9b1354ee4c54673d021de481a868
This commit is contained in:
wu.chunyang 2023-06-06 09:49:05 +08:00
parent e854cb5853
commit 49c16b889b
3 changed files with 15 additions and 0 deletions

View File

@ -499,6 +499,8 @@ function create_guest_image {
$TROVE_MANAGE db_load_datastore_config_parameters "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" \
$DEST/trove/trove/templates/$TROVE_DATASTORE_TYPE/validation-rules.json
fi
# NOTE(wuchunyang): Create log directory so that guest agent can rsync logs to this directory
test -e /var/log/guest-agent-logs || sudo mkdir -p /var/log/guest-agent-logs/ && sudo chmod 777 /var/log/guest-agent-logs
}
function create_registry_container {

View File

@ -21,6 +21,15 @@ ExecStartPre=/bin/bash -c "test -e /home/GUEST_USERNAME/trove-installed || sudo
ExecStartPre=/bin/bash -c "sudo chown -R GUEST_USERNAME:root /etc/trove /var/log/trove/ /home/GUEST_USERNAME/trove"
# The "[defult]" line in this file doesn't matter.
EnvironmentFile=/etc/trove/conf.d/guest_info.conf
# rsync trove guest agent log to CONTROLLER nodes, this is extremely useful for debugging in CI.
ExecStartPre=/bin/bash -c "sudo rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /home/GUEST_USERNAME/.ssh/id_rsa' -az --exclude='.*' /var/log HOST_SCP_USERNAME@$CONTROLLER:/var/log/guest-agent-logs/$guest_id"
# rsync trove containers stdout to CONTROLLER nodes
ExecStartPre=/bin/bash -c "sudo rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /home/GUEST_USERNAME/.ssh/id_rsa' -az --exclude='.*' /var/lib/docker/containers HOST_SCP_USERNAME@$CONTROLLER:/var/log/guest-agent-logs/$guest_id"
# Take care of the changes in requirements.txt
ExecStartPre=/bin/bash -c "sudo /opt/guest-agent-venv/bin/pip install -r /home/GUEST_USERNAME/trove/requirements.txt -c /opt/upper-constraints.txt"

View File

@ -341,6 +341,8 @@
ovn-northd: false
tempest_test_regex: ^trove_tempest_plugin\.tests
tempest_test_blacklist: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/trove-tempest-plugin"].src_dir }}/tempest_blacklist.txt'
zuul_copy_output:
'/var/log/guest-agent-logs/': 'logs'
- job:
name: trove-tempest-postgres
@ -420,6 +422,8 @@
ovn-northd: false
tempest_test_regex: ^trove_tempest_plugin\.tests
tempest_test_blacklist: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/trove-tempest-plugin"].src_dir }}/tempest_blacklist.txt'
zuul_copy_output:
'/var/log/guest-agent-logs/': 'logs'
- job:
name: publish-trove-guest-image