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

Fix lxd, so that it works with lxcfs #89540

Merged
merged 4 commits into from Jun 11, 2020

Conversation

Patryk27
Copy link
Member

@Patryk27 Patryk27 commented Jun 5, 2020

Motivation for this change

Currently, because of two separate bugs, lxd doesn't detect lxcfs at all.

It means that when you set a limit (e.g. lxc config set test limits.cpu 1), it does get enforced, but the container still sees all the resources from the host machine (e.g. if you run lxc exec test htop, you'll see all the cores).

It's a minor thing, but a bit annoying one - especially since many applications adjust their behavior to stuff from /proc, expecting it to reflect the actual state of affairs.

Seizing the day, I've also changed lxd to properly support nftables - thanks to this, it doesn't unnecessarily depend on iptables when config.networking.nftables.enable is enabled.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Patryk27 Patryk27 changed the title Fix lxd, so that it works Fix lxd, so that it works with lxcfs Jun 5, 2020
@ofborg ofborg bot requested review from fpletz, wucke13 and Mic92 June 5, 2020 13:31
@wucke13
Copy link
Contributor

wucke13 commented Jun 8, 2020

This looks good to me, but I can not test it ATM.

@Mic92
Copy link
Member

Mic92 commented Jun 8, 2020

Also makes sense too me. Do we have tests for lxc/lxd?

@Patryk27
Copy link
Member Author

Patryk27 commented Jun 8, 2020

I couldn't find any (I've searched inside nixos/tests) - I'll try creating one 🚀

@Mic92
Copy link
Member

Mic92 commented Jun 8, 2020

If we have a simple smoke test that I can run, I will merge this.

@Patryk27
Copy link
Member Author

Patryk27 commented Jun 8, 2020

Okie, ready!

@matthewbauer matthewbauer merged commit 656783a into NixOS:master Jun 11, 2020
@Patryk27 Patryk27 deleted the fixes/lxd-lxcfs branch November 29, 2020 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants