From d6927b31c42b5811eb46c08d8755b523b7a9438a Mon Sep 17 00:00:00 2001 From: Stefan Chivu Date: Fri, 27 Jan 2023 16:08:54 +0200 Subject: [PATCH] ceph-windows: Collect more artifacts This commit changes the run_tests script in order to include more logs and overall information as build artifacts, such as Windows client logs, Windows event logs, the ceph.conf on the client, the wnbd version and the status of the ceph cluster. Signed-off-by: Stefan Chivu --- scripts/ceph-windows/run_tests | 17 +++++++++++++++++ scripts/ceph-windows/setup_ceph_vstart | 1 + 2 files changed, 18 insertions(+) diff --git a/scripts/ceph-windows/run_tests b/scripts/ceph-windows/run_tests index e2d7699b..c6def137 100644 --- a/scripts/ceph-windows/run_tests +++ b/scripts/ceph-windows/run_tests @@ -8,11 +8,14 @@ if [[ ! -f $CEPH_KEYRING ]]; then echo "ERROR: The Ceph keyring file doesn't exi if [[ -z $WINDOWS_SSH_USER ]]; then echo "ERROR: The WINDOWS_SSH_USER env variable is not set"; exit 1; fi if [[ -z $WINDOWS_VM_IP ]]; then echo "ERROR: The WINDOWS_VM_IP env variable is not set"; exit 1; fi +if [[ -z $UBUNTU_SSH_USER ]]; then echo "ERROR: The UBUNTU_SSH_USER env variable is not set"; exit 1; fi +if [[ -z $UBUNTU_VM_IP ]]; then echo "ERROR: The UBUNTU_VM_IP env variable is not set"; exit 1; fi export SSH_USER=$WINDOWS_SSH_USER export SSH_ADDRESS=$WINDOWS_VM_IP WIN_USERSPACE_CRASH_DUMPS=${WIN_USERSPACE_CRASH_DUMPS:-"C:\\userspace_crash_dumps"} +COLLECT_EVENT_LOGS_SCRIPT_URL="https://raw.githubusercontent.com/ceph/ceph-build/main/scripts/ceph-windows/collect-event-logs.ps1" # # Clone ceph-win32-tests repo @@ -28,6 +31,7 @@ ssh_exec powershell.exe /workspace/repos/ceph-win32-tests/test_host/set_userspac # Copy the ceph.conf and keyring to the Windows VM # ssh_exec powershell.exe mkdir -force /ProgramData/ceph/out +ssh_exec powershell.exe mkdir -force /ProgramData/ceph/logs scp_upload $CEPH_WINDOWS_CONF /ProgramData/ceph/ceph.conf scp_upload $CEPH_KEYRING /ProgramData/ceph/keyring @@ -46,6 +50,8 @@ function collect_artifacts() { rm -rf $WORKSPACE/artifacts mkdir -p $WORKSPACE/artifacts + SSH_USER=$UBUNTU_SSH_USER SSH_ADDRESS=$UBUNTU_VM_IP ssh_exec $WORKSPACE/ceph/build/bin/ceph status + scp_download /workspace/test_results $WORKSPACE/artifacts/test_results if [[ "$INCLUDE_USERSPACE_CRASH_DUMPS" = true ]]; then scp_download /userspace_crash_dumps $WORKSPACE/artifacts/userspace_crash_dumps @@ -53,9 +59,20 @@ function collect_artifacts() { if [[ "$INCLUDE_CEPH_ZIP" = true ]]; then cp $WORKSPACE/ceph.zip $WORKSPACE/artifacts/ceph.zip fi + + mkdir -p $WORKSPACE/artifacts/client + + scp_download /ProgramData/ceph/logs $WORKSPACE/artifacts/client/logs + cp $CEPH_WINDOWS_CONF $WORKSPACE/artifacts/client + ssh_exec /wnbd/wnbd-client.exe version + ssh_exec curl.exe --retry-max-time 30 --retry 10 -L -o /workspace/collect-event-logs.ps1 $COLLECT_EVENT_LOGS_SCRIPT_URL + ssh_exec powershell.exe /workspace/collect-event-logs.ps1 -LogDirectory /workspace/eventlogs + scp_download /workspace/eventlogs $WORKSPACE/artifacts/client/eventlogs } trap collect_artifacts EXIT +# View cluster status before test run +SSH_USER=$UBUNTU_SSH_USER SSH_ADDRESS=$UBUNTU_VM_IP ssh_exec $WORKSPACE/ceph/build/bin/ceph status # # Run the Windows tests # diff --git a/scripts/ceph-windows/setup_ceph_vstart b/scripts/ceph-windows/setup_ceph_vstart index 798e79aa..b067a0cc 100644 --- a/scripts/ceph-windows/setup_ceph_vstart +++ b/scripts/ceph-windows/setup_ceph_vstart @@ -83,6 +83,7 @@ MON_HOST=$(cat $CEPH_CONF | grep -o "mon host \=.*") cat > $CEPH_WINDOWS_CONF << EOF [client] keyring = C:/ProgramData/ceph/keyring + log file = C:/ProgramData/ceph/logs/\$name.\$pid.log admin socket = C:/ProgramData/ceph/out/\$name.\$pid.asok client_mount_uid = 1000 client_mount_gid = 1000 -- 2.39.5