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

WIP Support nfs local volume mounts #2415

Closed
wants to merge 1 commit into from
Closed

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Feb 22, 2019

Allow users to create volumes with nfs shares.

These volumes will get mounted when the first container gets started
and then will remain mounted until the system reboots or the volume is
removed.

Signed-off-by: Daniel J Walsh [email protected]

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M labels Feb 22, 2019
@rhatdan
Copy link
Member Author

rhatdan commented Feb 22, 2019

@@ -39,6 +45,8 @@ $ podman volume create myvol
$ podman volume create

$ podman volume create --label foo=bar myvol

# podman volume create --opt type=nfs --opt o=addr=192.168.0.2,rw --opt device=:/nfsshare mynfsvol
Copy link
Member

Choose a reason for hiding this comment

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

Should this be device=:/nfsshare or device=/nfsshare (no colon)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both are supported.

@@ -28,7 +28,8 @@ be created at.`
},
Example: `podman volume create myvol
podman volume create
podman volume create --label foo=bar myvol`,
podman volume create --label foo=bar myvol
podman volume create --opt type=nfs --opt o=addr=192.168.0.2,rw --opt device=:/nfsshare mynfsvol`,
Copy link
Member

Choose a reason for hiding this comment

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

I've been trying to keep these to three examples. Could we kill line 31 and add '--label foo=bar' to line 29?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

libpod/volume.go Outdated
@@ -15,7 +23,7 @@ type VolumeConfig struct {
// Name of the volume
Name string `json:"name"`

Labels map[string]string `json:"labels"`
Labels map[string]string `jsno:"labels"`
Copy link
Member

Choose a reason for hiding this comment

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

s/jsno/json/

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

}
}
return ""
}
Copy link
Member

Choose a reason for hiding this comment

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

Should this function live in common instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is only used in volume now.

@TomSweeneyRedHat
Copy link
Member

Couple of nits, otherwise LGTM.

@mheon
Copy link
Member

mheon commented Feb 22, 2019

Oh dear.

We're going to need to add a state to volumes to store whether the volume is mounted (and potentially the mountpoint, for volume types without a consistent one?). That means we need to add locks back in, plus some work in the DB to add update/save functions.

Also, I really hate just storing all of this in Options... there should be an easy way of saying that a volume is sourced from NFS.

@rhatdan
Copy link
Member Author

rhatdan commented Feb 22, 2019

Why do we need to record this? The system nows. I don't think this should be recorded, if a container starts on a volume that is not mounted it will mount it.

@mheon
Copy link
Member

mheon commented Feb 22, 2019

Post-system restart? After every container using a volume has been removed?

I think we need to be able to tell if a volume is mounted. For now, I'm OK with leaving this as a mount.Mounted() check, but in the future we should be storing this in the DB so we know what the state of the system is.

@rhatdan
Copy link
Member Author

rhatdan commented Feb 22, 2019

Then you are likely to be wrong. Since a user could go in an umount the volume.

I am actually thinking about adding a podman volume mount and umount command.
But currently I think Docker just leaves these mounted until the system reboots.

@rhatdan
Copy link
Member Author

rhatdan commented Feb 23, 2019

@mheon @giuseppe @baude @vrothberg PTAL

@giuseppe
Copy link
Member

LGTM

@mheon
Copy link
Member

mheon commented Feb 24, 2019 via email

@rhatdan
Copy link
Member Author

rhatdan commented Feb 25, 2019

I disagee on this. This is an open bug and don't believe this needs to affect the libpod database.

@mheon
Copy link
Member

mheon commented Feb 25, 2019

At the very least I want to see a type field in the volume so we can easily determine whether this is a directory-backed volume or NFS-backed - just stuffing this in opts is not a proper solution

@rhatdan
Copy link
Member Author

rhatdan commented Feb 25, 2019

This behaviour matches Docker. These are considered local volumes. And I agree this is not the best solution, but I don't know how we are supposed to fix this unless, we have something hacking in the volumes code that looks for this type of signature and then refers to it as an local-nfs mount or something.

If we want to keep the documented behavior of Docker, then we don't want to force the users to execute different CLI.

@mheon
Copy link
Member

mheon commented Feb 25, 2019

We can retain the user interface for volume create, but parse the options before we store them and set a field in the DB telling us what the storage backend is

@rh-atomic-bot
Copy link
Collaborator

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

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 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 Mar 4, 2019
@rhatdan
Copy link
Member Author

rhatdan commented Mar 12, 2019

@mheon I would like to get this moving again. Any idea what you would like to see changed?

@rhatdan
Copy link
Member Author

rhatdan commented Mar 21, 2019

@mheon Continuing to rebase this one, waiting on you.

@mheon
Copy link
Member

mheon commented Mar 21, 2019

Most of what we need will land today or tomorrow.

}
mountOpts := options["o"]
device := options["device"]
if options["type"] == "nfs" {
Copy link
Member

Choose a reason for hiding this comment

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

This should not be an option. Volume has a "type" field, and that is what we should be using.

Copy link
Member

Choose a reason for hiding this comment

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

Correction, I meant Driver - I think I'd count NFS mounts as a type of volume driver...

Or we should add a type field. Let's not stuff critical information into maps. Make this top-level.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can add this under the covers, but if we want to follow the Docker CLI, we have to allow users to specify nfs in the manner.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, matching their CLI is fine, but let's not let the CLI determine how we set up internal data structures

@mheon
Copy link
Member

mheon commented Mar 21, 2019

I am pretty convinced that volume locks need to come back for this. I don't want to have to deal with concurrent mount/unmount operations happening.

@rhatdan
Copy link
Member Author

rhatdan commented Apr 4, 2019

@mheon What do I need to do with this PR Now?

@mheon
Copy link
Member

mheon commented Apr 4, 2019

Largely waiting on the cleanups/reworks in #2774 to land. Unfortunately that one keeps finding other bugs.

@rh-atomic-bot
Copy link
Collaborator

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

@TomSweeneyRedHat
Copy link
Member

@rhatdan this needs to be rebased but it looks like the PR that you were waiting on is the cause of the rebase. Perhaps we can merge this today?

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 12, 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 Apr 12, 2019
@rhatdan
Copy link
Member Author

rhatdan commented Apr 12, 2019

@mheon Could you take this one over and now do it the way you envision.

@mheon
Copy link
Member

mheon commented Apr 12, 2019 via email

@jwhonce jwhonce changed the title Support nfs local volume mounts WIP Support nfs local volume mounts May 6, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 6, 2019
Allow users to create volumes with nfs shares.

These volumes will get mounted when the first container gets started
and then will remain mounted until the system reboots or the volume is
removed.

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan
Copy link
Member Author

rhatdan commented Jun 8, 2019

@mheon Any update on this?

1 similar comment
@rhatdan
Copy link
Member Author

rhatdan commented Jul 21, 2019

@mheon Any update on this?

@rhatdan
Copy link
Member Author

rhatdan commented Aug 5, 2019

@mheon ping?

@mheon
Copy link
Member

mheon commented Aug 5, 2019

#3709 is the first step. Once that lands, I can get this in. And then probably volume drivers. And then IPv6.

@rh-atomic-bot
Copy link
Collaborator

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

@mheon
Copy link
Member

mheon commented Sep 4, 2019

Superceded by #3931

@mheon mheon closed this Sep 4, 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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

6 participants