Skip to content

Add linux device options and --devices flag to ctr#3424

Merged
dmcgowan merged 2 commits intocontainerd:masterfrom
crosbymichael:devices
Jul 22, 2019
Merged

Add linux device options and --devices flag to ctr#3424
dmcgowan merged 2 commits intocontainerd:masterfrom
crosbymichael:devices

Conversation

@crosbymichael
Copy link
Copy Markdown
Member

Closes #3066

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jul 17, 2019

Build succeeded.

Signed-off-by: Michael Crosby <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jul 18, 2019

Build succeeded.

Closes containerd#3066

Signed-off-by: Michael Crosby <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jul 18, 2019

Build succeeded.

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 18, 2019

Codecov Report

Merging #3424 into master will decrease coverage by 0.21%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3424      +/-   ##
==========================================
- Coverage   44.28%   44.06%   -0.22%     
==========================================
  Files         123      124       +1     
  Lines       13665    13732      +67     
==========================================
  Hits         6051     6051              
- Misses       6683     6750      +67     
  Partials      931      931
Flag Coverage Δ
#linux 47.84% <0%> (-0.26%) ⬇️
#windows 39.69% <0%> (-0.13%) ⬇️
Impacted Files Coverage Δ
oci/spec_opts_linux.go 0% <0%> (ø)
oci/spec_opts.go 29.3% <0%> (-1.29%) ⬇️
oci/spec_opts_windows.go 72.41% <0%> (-5.37%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 283d5d9...725d3ad. Read the comment docs.

opts = append(opts, oci.WithMemoryLimit(limit))
}
for _, dev := range context.StringSlice("device") {
opts = append(opts, oci.WithLinuxDevice(dev, "rwm"))
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.

Consider make device permission as option ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it can be added in a follow up if it's important to ppl. ctr is still a dev/testing tool and not a full featured cli

Comment thread oci/spec_opts_unix.go
"golang.org/x/sys/unix"
)

func deviceFromPath(path, permissions string) (*specs.LinuxDevice, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure we should implement this for non-Linux Unixen

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it should be fine for bsd and such

Copy link
Copy Markdown
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Does containerd client-ctr support "Add host devices to container"?

6 participants