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

Add support for devices in swarm #3930

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

zikaeroh
Copy link

@zikaeroh zikaeroh commented Dec 24, 2022

- What I did

This is for:

This simply plumbs devices through everything such that swarm can specify the devices field.

- How I did it

Largely based on:

But, plumbing devices instead of ulimits.

This needs moby/swarmkit#3106 and moby/moby#44695.

- How to test it

Still working on this; I'm finding it pretty difficult to get all of the pieces set up.

- Description for the changelog

Add support for devices in swarm mode.

@@ -68,6 +68,8 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
flags.SetAnnotation(flagSysCtl, "version", []string{"1.40"})
flags.Var(&opts.ulimits, flagUlimit, "Ulimit options")
flags.SetAnnotation(flagUlimit, "version", []string{"1.41"})
flags.Var(&opts.devices, flagDevice, "Devices to add")
flags.SetAnnotation(flagDevice, "version", []string{"1.42"})
Copy link
Author

Choose a reason for hiding this comment

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

This version is almost assuredly wrong. No idea if this should be 1.41, 1.42, or 1.43. I wasn't easily able to figure out what the current version is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently, the master's API version is 1.43: https://github.com/moby/moby/blob/master/api/common.go#L6

@thaJeztah
Copy link
Member

I wonder if we should consider adding type=device to the mounts API; the --device option uses the shorthand (<device>:<target>) format, which is known to have caused issues; using the mounts API also allows for more flexibility (options specific to devices); I seem to recall there was a discussion somewhere in https://github.com/moby/moby about this, but I can't find it right now (will do some more searching).

With that approach, a device would be added (from a UX endpoint); would use the --mount syntax, which would look something like;

--mount type=device,src=/dev/sdc.target=/dev/xvdc

Additional options that are specific to a device can (in future) be added to those (e.g. some of the constraints)

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.

3 participants