File tree Expand file tree Collapse file tree 7 files changed +34
-7
lines changed Expand file tree Collapse file tree 7 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717 IDs before calling libcontainer; it is recommended to use Go package
1818 github.com/moby/sys/user for that. (#3999 )
1919
20+ ### Fixed
21+ * ` runc exec -p ` no longer ignores specified ` ioPriority ` setting.
22+ Similarly, libcontainer's ` Container.Start ` and ` Container.Run `
23+ methods no longer ignore ` Process.IOPriority ` setting. (#4585 )
24+
2025## [ 1.2.0] - 2024-10-22
2126
2227> できるときにできることをやるんだ。それが今だ。
Original file line number Diff line number Diff line change @@ -707,6 +707,7 @@ func (c *Container) newInitConfig(process *Process) *initConfig {
707707 AppArmorProfile : c .config .AppArmorProfile ,
708708 ProcessLabel : c .config .ProcessLabel ,
709709 Rlimits : c .config .Rlimits ,
710+ IOPriority : c .config .IOPriority ,
710711 CreateConsole : process .ConsoleSocket != nil ,
711712 ConsoleWidth : process .ConsoleWidth ,
712713 ConsoleHeight : process .ConsoleHeight ,
@@ -729,6 +730,9 @@ func (c *Container) newInitConfig(process *Process) *initConfig {
729730 if len (process .Rlimits ) > 0 {
730731 cfg .Rlimits = process .Rlimits
731732 }
733+ if process .IOPriority != nil {
734+ cfg .IOPriority = process .IOPriority
735+ }
732736
733737 // Set misc properties.
734738
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ type initConfig struct {
8181 NoNewPrivileges bool `json:"no_new_privileges"`
8282 ProcessLabel string `json:"process_label"`
8383 Rlimits []configs.Rlimit `json:"rlimits"`
84+ IOPriority * configs.IOPriority `json:"io_priority,omitempty"`
8485
8586 // Miscellaneous properties, filled in by [Container.newInitConfig]
8687 // unless documented otherwise.
@@ -623,7 +624,7 @@ func setupScheduler(config *configs.Config) error {
623624 return nil
624625}
625626
626- func setupIOPriority (config * configs. Config ) error {
627+ func setupIOPriority (config * initConfig ) error {
627628 const ioprioWhoPgrp = 1
628629
629630 ioprio := config .IOPriority
Original file line number Diff line number Diff line change @@ -114,6 +114,9 @@ type Process struct {
114114
115115 Scheduler * configs.Scheduler
116116
117+ // IOPriority is a process I/O priority.
118+ //
119+ // If not empty, takes precedence over container's [configs.Config.IOPriority].
117120 IOPriority * configs.IOPriority
118121}
119122
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ func (l *linuxSetnsInit) Init() error {
7575 return err
7676 }
7777
78- if err := setupIOPriority (l .config . Config ); err != nil {
78+ if err := setupIOPriority (l .config ); err != nil {
7979 return err
8080 }
8181 // Tell our parent that we're ready to exec. This must be done before the
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ func (l *linuxStandardInit) Init() error {
159159 return err
160160 }
161161
162- if err := setupIOPriority (l .config . Config ); err != nil {
162+ if err := setupIOPriority (l .config ); err != nil {
163163 return err
164164 }
165165
Original file line number Diff line number Diff line change @@ -20,11 +20,25 @@ function teardown() {
2020 # Check the init process.
2121 runc exec test_ioprio ionice -p 1
2222 [ " $status " -eq 0 ]
23- [[ " $output " = * ' best-effort: prio 4' * ] ]
23+ [ " ${lines[0]} " = ' best-effort: prio 4' ]
2424
25- # Check the process made from the exec command .
25+ # Check an exec process, which should derive ioprio from config.json .
2626 runc exec test_ioprio ionice
2727 [ " $status " -eq 0 ]
28-
29- [[ " $output " = * ' best-effort: prio 4' * ]]
28+ [ " ${lines[0]} " = ' best-effort: prio 4' ]
29+
30+ # Check an exec with a priority taken from process.json,
31+ # which should override the ioprio in config.json.
32+ proc='
33+ {
34+ "terminal": false,
35+ "ioPriority": {
36+ "class": "IOPRIO_CLASS_IDLE"
37+ },
38+ "args": [ "/usr/bin/ionice" ],
39+ "cwd": "/"
40+ }'
41+ runc exec --process <( echo " $proc " ) test_ioprio
42+ [ " $status " -eq 0 ]
43+ [ " ${lines[0]} " = ' idle' ]
3044}
You can’t perform that action at this time.
0 commit comments