Skip to content

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.

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)

Signed-off-by: Zik Aeroh <48577114+zikaeroh@users.noreply.github.com>
@zikaeroh
Copy link
Author

It's been a long time since I sent this PR chain. I'm sorry to say I just don't have the bandwidth to try and push this idea forward anymore; I'm going to close them.

These PRs (moby/swarmkit#3106, moby/moby#44695, #3930) are pretty straightforward, so I think anyone could re-propose the same changes (by all means, take the code, no need to credit me in any form). I just don't want to mislead anyone into thinking these PRs are likely to go in (at least without more investment).

@zikaeroh zikaeroh closed this Jun 30, 2025
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