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

VM: Apply mount options to hotplugged disks #14898

Merged
merged 3 commits into from
Feb 5, 2025

Conversation

hamistao
Copy link
Contributor

@hamistao hamistao commented Jan 31, 2025

Closes #13677

Related CI tests in: canonical/lxd-ci#403

@github-actions github-actions bot added the Documentation Documentation needs updating label Jan 31, 2025
@hamistao hamistao force-pushed the consistent-mount-flags branch from 6f45819 to 4a65e35 Compare January 31, 2025 12:21
@github-actions github-actions bot removed the Documentation Documentation needs updating label Jan 31, 2025
@hamistao hamistao force-pushed the consistent-mount-flags branch from 4a65e35 to 120e907 Compare January 31, 2025 12:44
@hamistao hamistao marked this pull request as ready for review January 31, 2025 18:50
@hamistao
Copy link
Contributor Author

hamistao commented Jan 31, 2025

Two possible improvements for the future:

  • Also supporting passing mount options to the lxd-agent through raw.mount.options, like we already do with containers, which should be easily doable but would require some discussion first, so I did not want to rush it.
  • Removing old mount entries when removing devices, when removing/updating a disk device, old mount entries might linger. In the following example, I created a dir share device called foo with readonly enabled, then disabled readonly and enabled it once again, resulting in:
$ lxc exec vm -- mount | grep foo
lxd_foo on /mnt type virtiofs (ro,relatime)
lxd_foo on /mnt type virtiofs (rw,relatime)
lxd_foo on /mnt type virtiofs (ro,relatime)

@hamistao hamistao requested a review from tomponline January 31, 2025 18:53
lxd-agent/events.go Outdated Show resolved Hide resolved
@hamistao hamistao force-pushed the consistent-mount-flags branch 2 times, most recently from 08aa340 to 37370ac Compare February 3, 2025 13:33
@hamistao
Copy link
Contributor Author

hamistao commented Feb 4, 2025

@tomponline this should be ready to merge

lxd-agent/events.go Outdated Show resolved Hide resolved
@hamistao hamistao force-pushed the consistent-mount-flags branch 2 times, most recently from f03637e to 0fed3f6 Compare February 5, 2025 06:38
This applies to the 'ro' flag when `readonly` is enabled, but could be
extended to also use options provided through `raw.mount.options` or
other config key.

Signed-off-by: hamistao <[email protected]>
Uses `RunCommandContext` to avoid the deprecated `RunCommand`

Signed-off-by: hamistao <[email protected]>
@hamistao hamistao force-pushed the consistent-mount-flags branch from 0fed3f6 to 43a26ea Compare February 5, 2025 14:15
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 7d7f3f8 into canonical:main Feb 5, 2025
28 checks passed
tomponline added a commit to canonical/lxd-ci that referenced this pull request Feb 8, 2025
Tests for canonical/lxd#14898. I am assuming it
will be backported into 5.21. If not, let me know and I shall update the
tests accordingly.
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.

Mount flags for VM directory share disks are not passed to lxd-agent when hotplugged
2 participants