-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: change misleading error message to warning level #3316
Conversation
WalkthroughThe pull request introduces enhancements to the volume controller, focusing on error handling, logging, and volume state management. Key modifications include refining error logging to use warning levels for specific conditions, improving the logic for volume state transitions, and enhancing the management of replicas. These changes aim to ensure that the volume controller operates more robustly and provides clearer logging for operations related to volume and replica management. Changes
Assessment against linked issues
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
When new replicas are created, the following error messages are emitted in the longhorn-manager. Empty timestamp is expected in this case, so the error messages are misleading. Longhorn 9916 Signed-off-by: Derek Su <derek.su@suse.com>
@mergify backport v1.7.x v1.6.x |
✅ Backports have been created
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
controller/volume_controller.go (2)
Line range hint
991-992
: Refactor Suggestion: Simplify Switch Case BlocksIn the
reconcileAttachDetachStateMachine
function, consider refactoring theswitch
statement at lines 991-992 for improved readability. Grouping similar cases or extracting logic into helper functions can enhance maintainability.
Line range hint
3311-3311
: Enhance Log Message with Additional ContextAt line 3311, the log message uses
log.Warnf("%v", err)
. Consider adding context to the log message to aid in debugging, such as:-log.Warnf("%v", err) +log.Warnf("Failed to process volume %v: %v", v.Name, err)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
controller/volume_controller.go
(1 hunks)
🔇 Additional comments (7)
controller/volume_controller.go (7)
752-755
: Appropriate Use of Warnf
for Logging
At lines 752-755, the logging statement has been changed to use log.Warnf
instead of log.Errorf
. This adjustment correctly lowers the severity level of the log message, aligning with the intent to change misleading error messages to warning level.
Line range hint 882-889
: Ensure Correct Handling of Volume Robustness
At lines 882-889, the code appropriately updates the volume's robustness status and conditions when the volume is not in a faulted state. This ensures that the robustness is set to Unknown
unless the volume is faulted, in which case it checks for restore requirements.
Line range hint 1000-1004
: Correct Event Logging on Volume Detachment
At lines 1000-1004, the code correctly logs an event when a volume has been detached. This provides valuable information for monitoring and auditing volume state changes.
Line range hint 1048-1050
: Proper Event Logging on Volume Attachment
At lines 1048-1050, an event is recorded when the volume is attached to a node. This ensures transparency and traceability of volume operations.
Line range hint 2969-2970
: Confirm Log Request Mechanism
At lines 2969-2970, setting e.Spec.LogRequested = true
and r.Spec.LogRequested = true
requests logs from the engine and replicas. Verify that this mechanism functions as intended and does not introduce excessive logging or performance issues.
Line range hint 3010-3014
: Graceful Handling of Update Conflicts
At lines 3010-3014, the code checks for conflicts when updating resources and re-queues the volume if a conflict is detected. This ensures that transient conflicts are handled gracefully without causing failures in the reconciliation loop.
Line range hint 1686-1688
: Verify the Existence of the Priority Class
At lines 1686-1688, the code sets the PriorityClassName
for the Pod if the priorityClass
is not empty. Ensure that the specified priority class exists in the cluster to prevent scheduling issues.
Run the following script to verify that the priority class exists:
Which issue(s) this PR fixes:
Issue longhorn/longhorn#9916
When new replicas are created, the following error messages are emitted in the longhorn-manager. Empty timestamp is expected in this case, so the error messages are misleading.
What this PR does / why we need it:
Special notes for your reviewer:
Additional documentation or context