Skip to content

OCPEDGE-2491: Log pcs status and etcd member list after every recovery#30949

Open
lucaconsalvi wants to merge 2 commits intoopenshift:mainfrom
lucaconsalvi:tnf-recovery-post-test-logging
Open

OCPEDGE-2491: Log pcs status and etcd member list after every recovery#30949
lucaconsalvi wants to merge 2 commits intoopenshift:mainfrom
lucaconsalvi:tnf-recovery-post-test-logging

Conversation

@lucaconsalvi
Copy link
Copy Markdown

Summary

  • Add post-test logging of sudo pcs status and sudo podman exec etcd etcdctl member list
    -w table after every recovery test (pass or fail)
  • Uses SSH through the hypervisor instead of the Kubernetes API, which may be unavailable
    after recovery tests
  • Gated on HasHypervisorConfig() — no-op when hypervisor SSH credentials are not
    configured
  • Errors are logged but never fail the test

Details

Recovery tests currently don't log final cluster state, making it harder to diagnose
failures. This adds a logFinalClusterStatus helper registered via DeferCleanup in
BeforeEach that SSHs through the hypervisor to collect pacemaker and etcd membership
status from the cluster nodes after every test completes.

The function tries each node in order and stops after the first node where both commands
succeed (since both commands return cluster-wide state). If a node is unreachable or a
command fails, it logs the error and tries the next node.

Test plan

  • Verified logging fires on a passing test (etcd process crash recovery)
  • Verified logging fires on a failing test (BMC credential rotation — etcd timeout)
  • Confirmed graceful error handling when etcd container is stopped on a node

Fixes: OCPEDGE-2491

…y test

Add post-test logging of `sudo pcs status` and `sudo podman exec etcd
etcdctl member list -w table` via SSH through the hypervisor after every
recovery test (pass or fail). This provides visibility into the final
cluster state without relying on the Kubernetes API, which may be
unavailable after recovery tests.

The logging is registered via DeferCleanup in BeforeEach and is gated
on HasHypervisorConfig(). Errors are logged but never fail the test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot
Copy link
Copy Markdown

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 1, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 1, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 1, 2026

@lucaconsalvi: This pull request references OCPEDGE-2491 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

  • Add post-test logging of sudo pcs status and sudo podman exec etcd etcdctl member list
    -w table after every recovery test (pass or fail)
  • Uses SSH through the hypervisor instead of the Kubernetes API, which may be unavailable
    after recovery tests
  • Gated on HasHypervisorConfig() — no-op when hypervisor SSH credentials are not
    configured
  • Errors are logged but never fail the test

Details

Recovery tests currently don't log final cluster state, making it harder to diagnose
failures. This adds a logFinalClusterStatus helper registered via DeferCleanup in
BeforeEach that SSHs through the hypervisor to collect pacemaker and etcd membership
status from the cluster nodes after every test completes.

The function tries each node in order and stops after the first node where both commands
succeed (since both commands return cluster-wide state). If a node is unreachable or a
command fails, it logs the error and tries the next node.

Test plan

  • Verified logging fires on a passing test (etcd process crash recovery)
  • Verified logging fires on a failing test (BMC credential rotation — etcd timeout)
  • Confirmed graceful error handling when etcd container is stopped on a node

Fixes: OCPEDGE-2491

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0985e235-1fef-492f-815e-b1c30cbf3f27

📥 Commits

Reviewing files that changed from the base of the PR and between 78e49b4 and d451f3c.

📒 Files selected for processing (1)
  • test/extended/two_node/tnf_recovery.go

Walkthrough

Added a cleanup hook to always collect and log final cluster diagnostics after each spec in the two-node recovery test. Implemented a file-local helper that obtains PCS and etcd membership state via SSH, handling missing hypervisor/SSH prerequisites gracefully without failing the test.

Changes

Cohort / File(s) Summary
Test Diagnostics Enhancement
test/extended/two_node/tnf_recovery.go
Added g.DeferCleanup in BeforeEach to run post-spec. Introduced logFinalClusterStatus(nodes []corev1.Node) which: checks for hypervisor SSH config, builds SSH config and validates private key, prepares known-hosts files, runs services.PcsStatus and a remote sudo podman exec etcd etcdctl member list -w table on nodes, logs stdout/stderr, stops after the first node where both commands succeed, and logs errors/skips without failing the test.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lucaconsalvi
Once this PR has been reviewed and has the lgtm label, please assign jaypoulz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lucaconsalvi lucaconsalvi marked this pull request as ready for review April 2, 2026 13:08
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 2, 2026
@openshift-ci openshift-ci bot requested review from jaypoulz and jeff-roche April 2, 2026 13:09
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/extended/two_node/tnf_recovery.go`:
- Around line 828-843: The SSH helper calls currently discard stderr (using `_`)
and only log the error object on failure, losing valuable diagnostics; update
the calls to services.PcsStatus and core.ExecuteRemoteSSHCommand so they capture
both stdout and stderr (e.g., pcsOutput, pcsErrOutput, pcsErr and etcdOutput,
etcdErrOutput, etcdErr), and when pcsErr or etcdErr is non-nil include both the
stdout and stderr variables in the framework.Logf message (alongside the error)
to preserve command output for debugging while keeping the existing success-path
logging unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 562d68bd-fc7c-43f9-8584-c2979c2c83dc

📥 Commits

Reviewing files that changed from the base of the PR and between a938a04 and 78e49b4.

📒 Files selected for processing (1)
  • test/extended/two_node/tnf_recovery.go

@openshift-ci-robot
Copy link
Copy Markdown

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

Include stdout and stderr in error log messages for pcs status and etcd
member list commands, so diagnostic output is not lost on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot
Copy link
Copy Markdown

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 3, 2026

@lucaconsalvi: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-ovn-upgrade d451f3c link true /test e2e-gcp-ovn-upgrade
ci/prow/e2e-metal-ipi-ovn-ipv6 d451f3c link true /test e2e-metal-ipi-ovn-ipv6

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-trt
Copy link
Copy Markdown

openshift-trt bot commented Apr 3, 2026

Job Failure Risk Analysis for sha: d451f3c

Job Name Failure Risk
pull-ci-openshift-origin-main-e2e-gcp-ovn High
[Jira:Node][sig-node] Node non-cnv swap configuration should reject user override of swap settings via KubeletConfig API [OCP-86395] [Suite:openshift/conformance/parallel]
This test has passed 98.50% of 200 runs on release 5.0 [Overall] in the last week.
pull-ci-openshift-origin-main-e2e-vsphere-ovn High
[Jira:Node][sig-node] Node non-cnv swap configuration should reject user override of swap settings via KubeletConfig API [OCP-86395] [Suite:openshift/conformance/parallel]
This test has passed 98.50% of 200 runs on release 5.0 [Overall] in the last week.
pull-ci-openshift-origin-main-e2e-vsphere-ovn-upi High
[Jira:Node][sig-node] Node non-cnv swap configuration should reject user override of swap settings via KubeletConfig API [OCP-86395] [Suite:openshift/conformance/parallel]
This test has passed 98.50% of 200 runs on release 5.0 [Overall] in the last week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants