Skip to content

Fix lxd, so that it works with lxcfs#89540

Merged
matthewbauer merged 4 commits intoNixOS:masterfrom
Patryk27:fixes/lxd-lxcfs
Jun 11, 2020
Merged

Fix lxd, so that it works with lxcfs#89540
matthewbauer merged 4 commits intoNixOS:masterfrom
Patryk27:fixes/lxd-lxcfs

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.

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jun 5, 2020
@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 Mic92, fpletz and wucke13 June 5, 2020 13:31
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jun 5, 2020
@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
Patryk27 added a commit to Patryk27/nixpkgs-committers that referenced this pull request Dec 28, 2025
Hi,

I'd like to nominate myself - I've been submitting pull requests since 2020, started by packaging [netris](NixOS/nixpkgs#85382) and then went on to improving [LXD](NixOS/nixpkgs#89540), [packaging](NixOS/nixpkgs#91182) and [maintaining](https://github.com/NixOS/nixpkgs/pulls?q=author%3APatryk27+pcloud) pCloud (which, amazingly enough, required fixing a bug in [patchelf](NixOS/patchelf#544) itself!), and overall I've been implementing various quality of live improvements [here](NixOS/nixpkgs#207466) and [there](NixOS/nixpkgs#354755).

I've given [a talk about my Nix-driven blog](https://www.youtube.com/watch?v=_7wqXN-7ebw&t=6695s) during NixCon 2024 in Berlin, so it's possible we've already met irl!

Outside of Nix, I'm the maintainer of Rust's [AVR backend](rust-lang/rust#131651), with commits and merging rights to [LLVM](https://github.com/llvm/llvm-project/pulls?q=author%3APatryk27) - just adding as an extra "in case it helps" mention 😇 

Couple of weeks ago I decided to shift my priorities from working on custom projects to helping the communities I'm a part of more - having committer access to nixpkgs would allow me to make a greater impact as I intend to focus on reviewing and merging both ongoing and stale pull requests, since it seems there's always not enough people willing to review stuff!

Thanks, Patryk :-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants