Skip to content
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

pkg/importer: Increase number of nbdkit lines logged #3360

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

rwmjones
Copy link
Contributor

@rwmjones rwmjones commented Jul 31, 2024

30 is far too small. For "chatty" plugins like VDDK many more debugging lines will be printed for simple open calls. For debugging it is vital that we do not lose this information. Ideally I would set this to infinity.

Related: https://issues.redhat.com/browse/CNV-44894

Release note:

VDDK datasource: Increase number of nbdkit lines logged

CC @mrnold

30 is far too small.  For "chatty" plugins like VDDK many more
debugging lines will be printed for simple open calls.  For debugging
it is vital that we do not lose this information.  Ideally I would set
this to infinity.

Related: https://issues.redhat.com/browse/CNV-44894
Signed-off-by: Richard W.M. Jones <[email protected]>
@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jul 31, 2024
@kubevirt-bot
Copy link
Contributor

Hi @rwmjones. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@arnongilboa
Copy link
Collaborator

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2024
@coveralls
Copy link

Coverage Status

coverage: 59.172% (+0.008%) from 59.164%
when pulling a9f2836 on rwmjones:nbdkit-more-logs
into 1ac6087 on kubevirt:main.

Copy link
Collaborator

@akalenyu akalenyu left a comment

Choose a reason for hiding this comment

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

Looks good, if you want, you have the nbdkit cmd stdout in output *bufio.Reader

func (watcher NbdKitLogWatcherVddk) Start(output *bufio.Reader) {
so you could just write the entire thing into /tmp/nbdkit.log by dropping
_, err = f.WriteString(logLine)
if err != nil {
klog.Errorf("failed to write log line; %v", err)
}
in the scanner loop
(unless theres some implication in doing that)

@mrnold
Copy link
Contributor

mrnold commented Jul 31, 2024

Looks good, if you want, you have the nbdkit cmd stdout in output *bufio.Reader

func (watcher NbdKitLogWatcherVddk) Start(output *bufio.Reader) {

so you could just write the entire thing into /tmp/nbdkit.log by dropping

_, err = f.WriteString(logLine)
if err != nil {
klog.Errorf("failed to write log line; %v", err)
}

in the scanner loop
(unless theres some implication in doing that)

This is probably the way to go, to see everything from nbdkit/VDDK get logged. I think there is a password printed in plain text in there somewhere though, it might be a good idea to filter that out.

@rwmjones
Copy link
Contributor Author

I think there is a password printed in plain text in there somewhere though, it might be a good idea to filter that out.

The password is passed to nbdkit directly on the command line here:

pluginArgs = append(pluginArgs, "password="+password)

This is bad in several ways:

  • You expose the password to commands like ps (assuming someone has a shell inside the container).
  • It gets printed in nbdkit debug output, which you're filtering.
  • If the password starts with - or + then you likely have a security hole.

You can avoid all that by writing the password into a temporary file (ensure that the file is unreadable by other), and then passing password=+/path/to/temp/file on the command line instead. If you don't want the temp file, you can also use inherited file descriptors and pipes but it's a bit harder to implement.

More details here (scroll down a bit to where it talks about the password parameter):

https://libguestfs.org/nbdkit-vddk-plugin.1.html#PARAMETERS

@rwmjones
Copy link
Contributor Author

The test fails seem unrelated ...?

@rwmjones
Copy link
Contributor Author

/test pull-containerized-data-importer-e2e-hpp-latest

@kubevirt-bot
Copy link
Contributor

@rwmjones: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test pull-containerized-data-importer-e2e-hpp-latest

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.

@akalenyu
Copy link
Collaborator

The test fails seem unrelated ...?

correct:
#3024

/test pull-containerized-data-importer-e2e-hpp-latest

@akalenyu
Copy link
Collaborator

/test pull-containerized-data-importer-e2e-ceph

@akalenyu
Copy link
Collaborator

akalenyu commented Aug 1, 2024

Looks good, if you want, you have the nbdkit cmd stdout in output *bufio.Reader

func (watcher NbdKitLogWatcherVddk) Start(output *bufio.Reader) {

so you could just write the entire thing into /tmp/nbdkit.log by dropping

_, err = f.WriteString(logLine)
if err != nil {
klog.Errorf("failed to write log line; %v", err)
}

in the scanner loop
(unless theres some implication in doing that)

Let me know if you plan to take this suggestion

@rwmjones
Copy link
Contributor Author

rwmjones commented Aug 1, 2024

Let me know if you plan to take this suggestion

I didn't really understand what exactly was meant.

For the immediate customer bug we're facing, getting more log lines out from the customer's container is the most important thing here.

@akalenyu
Copy link
Collaborator

akalenyu commented Aug 1, 2024

Let me know if you plan to take this suggestion

I didn't really understand what exactly was meant.

For the immediate customer bug we're facing, getting more log lines out from the customer's container is the most important thing here.

I am suggesting to dump the entire log into a file

@rwmjones
Copy link
Contributor Author

rwmjones commented Aug 1, 2024

How can we see the log then? Currently the customer runs oc logs <podname> and they can see (unfortunately only) 30 lines of the log.

@arnongilboa
Copy link
Collaborator

arnongilboa commented Aug 1, 2024

Let me know if you plan to take this suggestion

I didn't really understand what exactly was meant.
For the immediate customer bug we're facing, getting more log lines out from the customer's container is the most important thing here.

I am suggesting to dump the entire log into a file

You can't ssh the pod if it failed/completed, so how would you get the nbd log if pod fails too quick? we can keep a debug pod running but not sure that's the best way to go. I guess that's the reason we put it in the pod log.

@akalenyu
Copy link
Collaborator

akalenyu commented Aug 1, 2024

How can we see the log then? Currently the customer runs oc logs <podname> and they can see (unfortunately only) 30 lines of the log.

You would have to watch that file in the container. Let me know if you want this merged as is

@rwmjones
Copy link
Contributor Author

rwmjones commented Aug 1, 2024

@mrnold If you're happy with this, then so I am. It's a minimal change to improve the situation and collect the logs, perhaps not the long term final fix.

The password issue noted above is also quite important. I may have a go at fixing that if I get time today.

@akalenyu
Copy link
Collaborator

akalenyu commented Aug 1, 2024

/approve
/hold

@mrnold unhold when ready

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 1, 2024
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akalenyu

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

The pull request process is described here

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 1, 2024
@mrnold
Copy link
Contributor

mrnold commented Aug 1, 2024

/unhold

I think it's fine to keep this pull request to the one small change, and implement the other suggestions separately.

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 1, 2024
@kubevirt-bot kubevirt-bot merged commit bae6196 into kubevirt:main Aug 1, 2024
19 checks passed
@fabiand
Copy link
Member

fabiand commented Aug 8, 2024

@akalenyu can we get this change backported to 4.15 and 4.14 (at least)?

@akalenyu
Copy link
Collaborator

akalenyu commented Aug 8, 2024

sure
/cherrypick release-v1.59

@kubevirt-bot
Copy link
Contributor

@akalenyu: new pull request created: #3374

In response to this:

sure
/cherrypick release-v1.59

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.

@akalenyu
Copy link
Collaborator

akalenyu commented Aug 8, 2024

/cherrypick release-v1.58

@kubevirt-bot
Copy link
Contributor

@akalenyu: new pull request created: #3375

In response to this:

/cherrypick release-v1.58

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.

@akalenyu
Copy link
Collaborator

akalenyu commented Aug 8, 2024

/cherrypick release-v1.57

@kubevirt-bot
Copy link
Contributor

@akalenyu: new pull request created: #3376

In response to this:

/cherrypick release-v1.57

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.

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants