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

Wait for mount command to finish when mounting volume #4305

Merged
merged 1 commit into from
Oct 30, 2019

Conversation

mheon
Copy link
Member

@mheon mheon commented Oct 20, 2019

command.Start() just starts the command. That catches some errors, but the nasty ones - bad options and similar - happen when the command runs. Use CombinedOutput() instead - it waits for the command to exit, and thus catches non-0 exit of the mount command (invalid options, for example).

STDERR from the mount command is directly used, which isn't necessarily the best, but we can't really get much more info on what went wrong.

Fixes #4303

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon

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

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S labels Oct 20, 2019
@mheon
Copy link
Member Author

mheon commented Oct 20, 2019

Still needs a test to verify we're correctly handling things.

logrus.Debugf("Running mount command: %s %s", mountPath, strings.Join(mountArgs, " "))
if output, err := mountCmd.CombinedOutput(); err != nil {
logrus.Debugf("Mount failed with %v", err)
return errors.Wrapf(errors.Errorf(string(output)), "error mounting volume %s", v.Name())
Copy link
Member

@rhatdan rhatdan Oct 20, 2019

Choose a reason for hiding this comment

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

I think you should wrap the err, and then put the string(output) into the extra information.

 		return errors.Wrapf(err, "error mounting volume %s: %v", v.Name(),errors.Errorf(string(output)))

@mheon
Copy link
Member Author

mheon commented Oct 20, 2019 via email

@rhatdan
Copy link
Member

rhatdan commented Oct 21, 2019

Well 32 is #define EPIPE 32 /* Broken pipe */

That way the caller could at least check for errors.Cause() on the error.

@baude
Copy link
Member

baude commented Oct 22, 2019

did you add the test? is this ready for merge?

@mheon
Copy link
Member Author

mheon commented Oct 22, 2019

Not yet. Will try and get to it today.

@mheon
Copy link
Member Author

mheon commented Oct 23, 2019

Test added

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2019
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #4298) made this pull request unmergeable. Please resolve the merge conflicts.

@baude
Copy link
Member

baude commented Oct 27, 2019

rebase and lets merge!

@mheon
Copy link
Member Author

mheon commented Oct 28, 2019

Rebased

command.Start() just starts the command. That catches some
errors, but the nasty ones - bad options and similar - happen
when the command runs. Use CombinedOutput() instead - it waits
for the command to exit, and thus catches non-0 exit of the
`mount` command (invalid options, for example).

STDERR from the `mount` command is directly used, which isn't
necessarily the best, but we can't really get much more info on
what went wrong.

Fixes containers#4303

Signed-off-by: Matthew Heon <[email protected]>
@mheon
Copy link
Member Author

mheon commented Oct 30, 2019

CI should go green

@baude
Copy link
Member

baude commented Oct 30, 2019

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 30, 2019
@baude
Copy link
Member

baude commented Oct 30, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 30, 2019
@baude
Copy link
Member

baude commented Oct 30, 2019

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 30, 2019
@openshift-merge-robot openshift-merge-robot merged commit 32266d1 into containers:master Oct 30, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NFS volumes created using podman volume create unavailable in container
6 participants