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

volume: move validating volume dest from client to server. #11231

Merged
merged 3 commits into from
Aug 17, 2021

Conversation

flouthoc
Copy link
Collaborator

Closes: #10900

Move validating destination path for volume from client to server side.

@flouthoc
Copy link
Collaborator Author

@rhatdan PTAL

@@ -1456,6 +1456,10 @@ func WithNamedVolumes(volumes []*ContainerNamedVolume) CtrCreateOption {
return errors.Wrapf(err, "error processing options for named volume %q mounted at %q", vol.Name, vol.Dest)
}

if err = parse.ValidateVolumeCtrDir(vol.Dest); err != nil {
return errors.Wrapf(err, "error validating destination path for named volume %q mounted at %q", vol.Name, vol.Dest)
Copy link
Member

Choose a reason for hiding this comment

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

This looks like you created a stutter. Does vol.Dest get mentioned in the err twice?
Don't start error messages with the word "error" otherwise they are printed on error with

Error: error ...

I know there are other errors in options.go with this problem, please fix them while you are at it.

I would like to eventually go through the error messages in all of podman and remove any that begin with "error".

Also see what this error message looks like when it happens. Is this information the user needs or does it hide the error amongst a flood of words.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes this adds stutter i verified let me fix this :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rhatdan resolved for options.go i'll create a seperate PR cleaning this in entire project.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 16, 2021
@flouthoc flouthoc requested a review from rhatdan August 16, 2021 11:43
}

if err = parse.ValidateVolumeCtrDir(vol.Dest); err != nil {
return errors.Wrapf(err, "validating destination path for named volume %q mounted at %q", vol.Name, vol.Dest)
Copy link
Member

Choose a reason for hiding this comment

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

I think this will still stutter vol.Dest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh my bad let me fix that i missed it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rhatdan Fixed but there is more Error: error stutter coming from libpod/runtime_ctr.go should i fix that in the same PR ?

Copy link
Member

Choose a reason for hiding this comment

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

No let's move that to a separate bigger PR.

@flouthoc flouthoc force-pushed the move-volume-dest-to-server branch from ad104e1 to 065d6a1 Compare August 16, 2021 11:53
@flouthoc flouthoc requested a review from rhatdan August 16, 2021 12:00
@flouthoc
Copy link
Collaborator Author

Fixing failing tests

@flouthoc flouthoc force-pushed the move-volume-dest-to-server branch 5 times, most recently from c27ee10 to 0b9b3d6 Compare August 16, 2021 18:56
@TomSweeneyRedHat
Copy link
Member

@flouthoc a lot of red angry tests still

@flouthoc flouthoc force-pushed the move-volume-dest-to-server branch from 0b9b3d6 to de742ec Compare August 17, 2021 08:57
Copy link
Collaborator Author

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

@mheon @TomSweeneyRedHat @rhatdan made some significant changes as compared to yesterday's code. Could I please get a review again ?

if _, ok := unifiedMounts[m.Destination]; !ok {
unifiedMounts[m.Destination] = m
if err = parse.ValidateVolumeCtrDir(m.Destination); err != nil {
return nil, nil, nil, errors.Wrapf(err, "validating destination path for common mount %q", m)
Copy link
Member

Choose a reason for hiding this comment

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

The output of this error is going to be hard to interpret by the user? The m struct for the user is going to be ugly. Does the user need it, and does the user know what a "common mount" is?

@flouthoc flouthoc force-pushed the move-volume-dest-to-server branch from de742ec to 2f6153a Compare August 17, 2021 10:42
@flouthoc flouthoc force-pushed the move-volume-dest-to-server branch from 2f6153a to 3cee855 Compare August 17, 2021 10:44
return nil, nil, nil, err
}
cleanDestination := filepath.Clean(v.Destination)
if _, ok := unifiedOverlays[cleanDestination]; ok {
Copy link
Member

Choose a reason for hiding this comment

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

Logic here is wrong - the ok is flipped, needs to be !ok. This predates your changes, but we might as well fix it now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mheon this was already here before my pr, should i create a separate PR after this so its easier to revert isolated change ? . WDYT ?

Copy link
Member

Choose a reason for hiding this comment

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

Same PR but separate commit is fine

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mheon please take a look , added a seperate commit.

@flouthoc flouthoc requested a review from mheon August 17, 2021 15:26
@mheon
Copy link
Member

mheon commented Aug 17, 2021

LGTM

Copy link
Member

@rhatdan rhatdan left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 17, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, rhatdan

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 openshift-ci bot merged commit a7a55ea into containers:main Aug 17, 2021
@asbachb
Copy link

asbachb commented Dec 26, 2021

Am I right that this is not part of 3.4.4?

@rhatdan
Copy link
Member

rhatdan commented Dec 26, 2021

It should be.

@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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.

Podman remote windows cannot mount volume: invalid container path "/data", must be an absolute path
5 participants