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

Support [Slice] in manage_unit and manage_dropin #420

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

traylenator
Copy link
Contributor

@traylenator traylenator commented Mar 4, 2024

Pull Request (PR) description

For example the following is now possible:

systemd::manage_dropin { 'userlimits.conf':
  unit  => 'user-.slice',
  slice_entry => {
    MemoryMax        => '10G',
    MemoryAccounting => true,
  }
}

The directives for [Slice] are typically a subset of [Service].

Adds new types:

  • Systemd::Unit::Amount
  • Systemd::Unit::Percent
  • Systemd::Unit::AmountOrPercent

This Pull Request (PR) fixes the following issues

For example the following is now possible:

```puppet
systemd::manage_dropin { 'userlimits.conf':
  unit  => 'user-.slice',
  slice_entry => {
    MemoryMax        => '10G',
    MemoryAccounting => true,
  }
}
```

The directives for `[Slice]` are typically a subset of `[Service]`.

* https://www.freedesktop.org/software/systemd/man/latest/systemd.slice.html
* https://www.freedesktop.org/software/systemd/man/latest/systemd.resource-control.html
Copy link
Contributor

@TheMeier TheMeier left a comment

Choose a reason for hiding this comment

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

There is also a couple more parameters in the latest systemd that are missing:

  • StartupCPUWeight
  • AllowedCPUs
  • StartupAllowedCPUs
  • StartupMemoryLow
  • DefaultStartupMemoryLow
  • StartupMemoryLow
  • DefaultStartupMemoryLow
  • StartupMemoryHigh
  • StartupMemoryMax
  • StartupMemorySwapMax
  • MemoryZSwapMax
  • StartupMemoryZSwapMax
  • AllowedMemoryNodes
  • StartupAllowedMemoryNodes

Disclaimer: I do not have experience with managing slices.
I wonder what the slice name user-.slice means. In the documentation I did only find the root slice -.slice 2nd level slices foo.slice and subsequent slices foo-bar.slice. So I assume user-.slice is equivalent to user.slice

REFERENCE.md Show resolved Hide resolved
REFERENCE.md Outdated Show resolved Hide resolved
REFERENCE.md Outdated Show resolved Hide resolved
@traylenator
Copy link
Contributor Author

There is also a couple more parameters in the latest systemd that are missing:

  • StartupCPUWeight
  • AllowedCPUs
  • StartupAllowedCPUs
  • StartupMemoryLow
  • DefaultStartupMemoryLow
  • StartupMemoryLow
  • DefaultStartupMemoryLow
  • StartupMemoryHigh
  • StartupMemoryMax
  • StartupMemorySwapMax
  • MemoryZSwapMax
  • StartupMemoryZSwapMax
  • AllowedMemoryNodes
  • StartupAllowedMemoryNodes

I don't want to add everything.

Get a good set in and things like StartupMemoryZSwapMax are super obscure in my opinion. Let someone who uses
them add them or I'll happy add later.

@TheMeier TheMeier self-requested a review March 4, 2024 18:56
@traylenator traylenator merged commit 7b7d722 into voxpupuli:master Mar 5, 2024
34 checks passed
@traylenator traylenator deleted the slice branch March 5, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add possibility to setup limits for user sessions
3 participants