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

Device: Add ownership.inherit setting for unix-hotplug devices #14417

Merged

Conversation

kadinsayani
Copy link
Contributor

@kadinsayani kadinsayani commented Nov 7, 2024

Fixes the second bug raised in #14266.

This PR adds a setting, ownership.inherit for unix-hotplug devices and a function unixDeviceOwnership() which returns device ownership.

New behaviour:

  • The default setting for ownership.inherit is false;
  • When ownership.inherit is set to true, the device ownership is inherited from the host;
  • ownership.inherit cannot be set to true when gid and uid are set.

Existing behaviour (unchanged):

  • When gid and uid are set, they are used for device ownership;
  • If gid and uid are not present in the config, root (0) ownership is used.

@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from a0b63fd to 8fed8a3 Compare November 7, 2024 23:07
@kadinsayani kadinsayani changed the title unix-hotplug ownership fix lxd/device: unix-hotplug ownership fix Nov 7, 2024
@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from 8fed8a3 to 0d5c055 Compare November 7, 2024 23:20
simondeziel
simondeziel previously approved these changes Nov 8, 2024
@tomponline
Copy link
Member

@kadinsayani please can you update the PR description to explain the change of behaviour in this PR and what, if any, will change for existing users?

@kadinsayani
Copy link
Contributor Author

@kadinsayani please can you update the PR description to explain the change of behaviour in this PR and what, if any, will change for existing users?

Sure thing!

@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch 3 times, most recently from db02e22 to 4c9ee63 Compare November 12, 2024 16:08
@github-actions github-actions bot added the Documentation Documentation needs updating label Nov 12, 2024
Copy link

Heads up @mionaalex - the "Documentation" label was applied to this issue.

@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch 3 times, most recently from a25f26f to 81478b0 Compare November 12, 2024 18:37
@kadinsayani
Copy link
Contributor Author

I noticed some wording inconsistencies in the documentation for unix-hotplug and the other unix device types. I've opened #14451 to track the issue and engage @minaelee for feedback. I'll open up a separate PR to update the docs and resolve the issue.

simondeziel
simondeziel previously approved these changes Nov 13, 2024
@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch 2 times, most recently from 13be986 to ebc953a Compare November 13, 2024 17:19
@kadinsayani
Copy link
Contributor Author

@tomponline, do we need an API extension for the new setting even if we're not adding tests?

@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from ebc953a to c78aeda Compare November 13, 2024 17:43
@tomponline
Copy link
Member

@tomponline, do we need an API extension for the new setting even if we're not adding tests?

yes new settings require API extensions in order for clients to be able to ascertain whether the server supports the setting.

@kadinsayani
Copy link
Contributor Author

@tomponline, do we need an API extension for the new setting even if we're not adding tests?

yes new settings require API extensions in order for clients to be able to ascertain whether the server supports the setting.

Gotcha, makes sense.

@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from c78aeda to 2f191aa Compare November 14, 2024 15:46
@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch 5 times, most recently from 8aa9181 to b50e48b Compare November 18, 2024 18:28
@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from c3562a4 to c6ab941 Compare November 18, 2024 23:05
@kadinsayani kadinsayani changed the title lxd/device: unix-hotplug ownership fix lxd/device: Add ownership.inherit setting for unix-hotplug devices Nov 19, 2024
@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from c6ab941 to 41ef286 Compare November 25, 2024 19:30
@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from 41ef286 to 98feba4 Compare November 25, 2024 19:42
@kadinsayani kadinsayani changed the title lxd/device: Add ownership.inherit setting for unix-hotplug devices Device: Add ownership.inherit setting for unix-hotplug devices Nov 26, 2024
@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from 98feba4 to c143d04 Compare November 29, 2024 15:42
@kadinsayani
Copy link
Contributor Author

@tomponline rebased 👍

@tomponline
Copy link
Member

rebase please

@kadinsayani kadinsayani force-pushed the 14266-unix-hotplug-ownership-fix branch from c143d04 to de25799 Compare December 2, 2024 14:20
@kadinsayani
Copy link
Contributor Author

rebase please

Rebased.

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

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

Thanks!

@tomponline tomponline merged commit cb1a3e0 into canonical:main Dec 3, 2024
27 checks passed
@kadinsayani kadinsayani deleted the 14266-unix-hotplug-ownership-fix branch December 3, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Changes to the REST API Documentation Documentation needs updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency in unix-hotplug when multiple devices share product/vendor IDs
3 participants