Skip to content

Add interface to remove mounts.#544

Merged
zhouhao3 merged 1 commit intoopencontainers:masterfrom
rhatdan:mounts
Dec 20, 2017
Merged

Add interface to remove mounts.#544
zhouhao3 merged 1 commit intoopencontainers:masterfrom
rhatdan:mounts

Conversation

@rhatdan
Copy link
Copy Markdown
Contributor

@rhatdan rhatdan commented Dec 15, 2017

We want to add a mount point to /dev/shm using the default spec,
but we don't want to mount /dev/shm via a tmpfs and then add our mountpoint
over it.

RemoveMount will remove a mount point based on the Destination, if it exists.
Does not return any error if the mount point does not exist. Also added
Mounts() interface so that I could populate a test for new feature. Returns
the list of mounts.

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Dec 15, 2017

@mrunalp @philips @crosbymichael PTAL

)

func main() {
util.Skip("TODO: mounts generation options have not been implemented", "")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test is for runtime validation (and the TODO is stale now that #279 has landed, but that's another matter).

Tests for generation functionality (which is what you're adding in this PR) should go in generate/generate_test.go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not sure why you would not want to have this in the validation code? This seems like the correct place unless you are dropping the validation code also?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure why you would not want to have this in the validation code?

There are several types of validation in this repo:

  1. Config validation in validate, with unit tests in validate/validate_test.go.
  2. Runtime validation (which calls the runtime executable, e.g. here) in validation. There are no unit tests for this (yet?).
  3. Config generation argument checks in generate, with unit tests (of which there are currently few) in generate/generate_test.go.

The tests you're currently adding here (a type-2 location) belong to type-3 (generation unit tests).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok copied it to the generate_test.go. But not sure if I should remove it totally from Validate. Currently tests in both places.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok copied it to the generate_test.go.

That looks good to me.

But not sure if I should remove it totally from Validate.

I think you should, because the test has nothing to do with runtime compliance (which is what validation/ is for). It's just testing the generate implementation, so the generate_test.go test you've added is all you need.

@rhatdan rhatdan force-pushed the mounts branch 5 times, most recently from 40c525c to 1be2b1e Compare December 17, 2017 11:52
cli.StringSliceFlag{Name: "linux-sysctl", Usage: "add sysctl settings e.g net.ipv4.forward=1"},
cli.StringSliceFlag{Name: "linux-uidmappings", Usage: "add UIDMappings e.g HostID:ContainerID:Size"},
cli.StringSliceFlag{Name: "mounts-add", Usage: "configures additional mounts inside container"},
cli.StringSliceFlag{Name: "mounts-remove", Usage: "remove destionation mountpoints from inside container"},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: destionation typo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@zhouhao3
Copy link
Copy Markdown

The appropriate content should be added to completions/bash.

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Dec 18, 2017

@q384566678 Added to completions/bash

@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Dec 18, 2017

@mrunalp PTAL

@mrunalp
Copy link
Copy Markdown
Contributor

mrunalp commented Dec 19, 2017

One of the commits isn't signed. Otherwise looks good.

We want to add a mount point to /dev/shm using the default spec,
but we don't want to mount /dev/shm via a tmpfs and then add our mountpoint
over it.

RemoveMount will remove a mount point based on the Destination, if it exists.
Does not return any error if the mount point does not exist.  Also added
Mounts() interface so that I could populate a test for new feature. Returns
the list of mounts.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@rhatdan
Copy link
Copy Markdown
Contributor Author

rhatdan commented Dec 19, 2017

@mrunalp Fixed PR.

@mrunalp
Copy link
Copy Markdown
Contributor

mrunalp commented Dec 19, 2017

LGTM

Approved with PullApprove

1 similar comment
@zhouhao3
Copy link
Copy Markdown

zhouhao3 commented Dec 20, 2017

LGTM

Approved with PullApprove

@zhouhao3 zhouhao3 merged commit ecdc8ef into opencontainers:master Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants