Skip to content

Bug 2019532: Logger object in LSO does not log source location accurately#299

Merged
openshift-merge-robot merged 3 commits intoopenshift:masterfrom
dobsonj:bug2019532-klog
Feb 4, 2022
Merged

Bug 2019532: Logger object in LSO does not log source location accurately#299
openshift-merge-robot merged 3 commits intoopenshift:masterfrom
dobsonj:bug2019532-klog

Conversation

@dobsonj
Copy link
Copy Markdown
Member

@dobsonj dobsonj commented Dec 3, 2021

@openshift-ci openshift-ci Bot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Dec 3, 2021
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Dec 3, 2021

@dobsonj: This pull request references Bugzilla bug 2019532, which is invalid:

  • expected the bug to target the "4.10.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

Bug 2019532: Logger object in LSO does not log source location accurately

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/test-infra repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Dec 3, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dobsonj

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 3, 2021
@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Dec 3, 2021

/bugzilla refresh
/assign @gnufied

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Dec 3, 2021

@dobsonj: This pull request references Bugzilla bug 2019532, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @chao007

Details

In response to this:

/bugzilla refresh
/assign @gnufied

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/test-infra repository.

@openshift-ci openshift-ci Bot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Dec 3, 2021
@openshift-ci openshift-ci Bot requested a review from chao007 December 3, 2021 00:37
@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Dec 3, 2021

sample log file from these changes after adding a couple of LV's and enabling discovery:
local-storage-operator-74b94cc95f-ssbjs.20211202.log

@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Dec 3, 2021

I ended up stashing the NewDelegatingLogger implementation on a separate branch, if that seems better:
master...dobsonj:bug2019532
Still, it's just a workaround, and klog may be more reliable / less likely to break, and it would be more consistent with our other controllers.

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 22, 2021
@openshift-bot
Copy link
Copy Markdown
Contributor

/bugzilla refresh

The requirements for Bugzilla bugs have changed (BZs linked to PRs on master branch need to target OCP 4.11), recalculating validity.

@openshift-ci openshift-ci Bot removed the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jan 28, 2022
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jan 28, 2022

@openshift-bot: This pull request references Bugzilla bug 2019532, which is invalid:

  • expected the bug to target the "4.11.0" release, but it targets "4.10.0" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/bugzilla refresh

The requirements for Bugzilla bugs have changed (BZs linked to PRs on master branch need to target OCP 4.11), recalculating validity.

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/test-infra repository.

@openshift-ci openshift-ci Bot added the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Jan 28, 2022
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 3, 2022
@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Feb 3, 2022

/hold
for manual testing

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 3, 2022
@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Feb 3, 2022

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 3, 2022
@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Feb 3, 2022

/cc @gnufied

@openshift-ci openshift-ci Bot requested a review from gnufied February 3, 2022 23:05
Comment thread common/provisioner_utils.go Outdated
})
if opRes != controllerutil.OperationResultNone {
pvLogger.Info("pv changed", "operation", opRes)
klog.Infof("PV changed, name = %s, status = %s", pvName, opRes)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we use InfoS in these places?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

klog doesn't have any structured logging functions that I could find... at least not this version of it. Am I missing something obvious?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, that was added in klog v2 it looks like, and LSO is still on v1:

$ grep klog go.mod 
        k8s.io/klog v1.0.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm okay. Lets handle this later.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hold on, I made the changes, but need to retest.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pushed.

@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Feb 4, 2022

Comment on lines -348 to +344
logger.Error(err, " error creating local-storage directory ", "symLinkLocation", r.symlinkLocation)
os.Exit(-1)
klog.ErrorS(err, "error creating local-storage directory", "symLinkLocation", r.symlinkLocation)
return ctrl.Result{}, err
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is buried in the logging changes, so I just want to point out the os.Exit call I removed here--that seemed very wrong to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I distinctly remember spotting this during review, but at that time my thinking was - if we can't create local-storage root directory, something is indeed wrong with the configuration/node and exiting here will cause pod to crash loop and throw easy to spot errors that might be helpful (basically complain as loudly as we can, if things aren't really working).

@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Feb 4, 2022

/bugzilla refresh

@openshift-ci openshift-ci Bot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Feb 4, 2022
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Feb 4, 2022

@dobsonj: This pull request references Bugzilla bug 2019532, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.11.0) matches configured target release for branch (4.11.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @chao007

Details

In response to this:

/bugzilla refresh

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/test-infra repository.

@gnufied
Copy link
Copy Markdown
Member

gnufied commented Feb 4, 2022

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2022
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Feb 4, 2022

@dobsonj: all tests passed!

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/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 843d3ca into openshift:master Feb 4, 2022
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Feb 4, 2022

@dobsonj: All pull requests linked via external trackers have merged:

Bugzilla bug 2019532 has been moved to the MODIFIED state.

Details

In response to this:

Bug 2019532: Logger object in LSO does not log source location accurately

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/test-infra repository.

@dobsonj
Copy link
Copy Markdown
Member Author

dobsonj commented Feb 4, 2022

/cherry-pick release-4.10

@openshift-cherrypick-robot
Copy link
Copy Markdown

@dobsonj: new pull request created: #317

Details

In response to this:

/cherry-pick release-4.10

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/test-infra repository.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants