-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
[Slice]
in manage_unit||dropin
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
- Loading branch information
1 parent
df74218
commit 236f5e1
Showing
8 changed files
with
219 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'Systemd::Unit::Slice' do | ||
it { is_expected.to allow_value({ 'MemoryAccounting' => true }) } | ||
|
||
it { | ||
is_expected.to allow_value( | ||
{ | ||
'MemoryLow' => '100', | ||
'MemoryMin' => '10%', | ||
'MemoryHigh' => '8G', | ||
'MemoryMax' => 'infinity', | ||
'MemorySwapMax' => '1T', | ||
} | ||
) | ||
} | ||
|
||
it { is_expected.not_to allow_value({ 'MemoryHigh' => '1P' }) } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# @summary Possible keys for the [Slice] section of a unit file | ||
# @see https://www.freedesktop.org/software/systemd/man/systemd.slice.html | ||
# @see https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html | ||
# | ||
type Systemd::Unit::Slice = Struct[ | ||
{ | ||
Optional['CPUAccounting'] => Boolean, | ||
Optional['CPUQuota'] => Pattern['^([1-9][0-9]*)%$'], | ||
Optional['CPUShares'] => Integer[2,262144], | ||
Optional['Delegate'] => Boolean, | ||
Optional['DeviceAllow'] => String[1], | ||
Optional['DevicePolicy'] => Enum['auto','closed','strict'], | ||
Optional['IOAccounting'] => Boolean, | ||
Optional['IODeviceWeight'] => Array[Hash[Stdlib::Absolutepath, Integer[1,10000], 1, 1]], | ||
Optional['IOReadBandwidthMax'] => Array[Hash[Stdlib::Absolutepath, Pattern['^(\d+(K|M|G|T)?)$'], 1, 1]], | ||
Optional['IOReadIOPSMax'] => Array[Hash[Stdlib::Absolutepath, Pattern['^(\d+(K|M|G|T)?)$'], 1, 1]], | ||
Optional['IOWeight'] => Integer[1,10000], | ||
Optional['IOWriteBandwidthMax'] => Array[Hash[Stdlib::Absolutepath, Pattern['^(\d+(K|M|G|T)?)$'], 1, 1]], | ||
Optional['IOWriteIOPSMax'] => Array[Hash[Stdlib::Absolutepath, Pattern['^(\d+(K|M|G|T)?)$'], 1, 1]], | ||
Optional['MemoryAccounting'] => Boolean, | ||
Optional['MemoryHigh'] => Pattern['\A(infinity|\d+(K|M|G|T|%)?(:\d+(K|M|G|T|%)?)?)\z'], | ||
Optional['MemoryLimit'] => Pattern['\A(infinity|\d+(K|M|G|T|%)?(:\d+(K|M|G|T|%)?)?)\z'], # dep'd in systemd | ||
Optional['MemoryLow'] => Pattern['\A(infinity|\d+(K|M|G|T|%)?(:\d+(K|M|G|T|%)?)?)\z'], | ||
Optional['MemoryMax'] => Pattern['\A(infinity|\d+(K|M|G|T|%)?(:\d+(K|M|G|T|%)?)?)\z'], | ||
Optional['MemoryMin'] => Pattern['\A(infinity|\d+(K|M|G|T|%)?(:\d+(K|M|G|T|%)?)?)\z'], | ||
Optional['MemorySwapMax'] => Pattern['\A(infinity|\d+(K|M|G|T|%)?(:\d+(K|M|G|T|%)?)?)\z'], | ||
Optional['Slice'] => String[1], | ||
Optional['StartupCPUShares'] => Integer[2,262144], | ||
Optional['StartupIOWeight'] => Integer[1,10000], | ||
Optional['TasksAccounting'] => Boolean, | ||
Optional['TasksMax'] => Variant[Integer[1],Pattern['^(infinity|([1-9][0-9]?$|^100)%)$']], | ||
} | ||
] |