File tree Expand file tree Collapse file tree 5 files changed +23
-4
lines changed Expand file tree Collapse file tree 5 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -700,6 +700,7 @@ func (c *Container) newInitConfig(process *Process) *initConfig {
700700		AppArmorProfile :  c .config .AppArmorProfile ,
701701		ProcessLabel :     c .config .ProcessLabel ,
702702		Rlimits :          c .config .Rlimits ,
703+ 		IOPriority :       c .config .IOPriority ,
703704		CreateConsole :    process .ConsoleSocket  !=  nil ,
704705		ConsoleWidth :     process .ConsoleWidth ,
705706		ConsoleHeight :    process .ConsoleHeight ,
@@ -722,6 +723,9 @@ func (c *Container) newInitConfig(process *Process) *initConfig {
722723	if  len (process .Rlimits ) >  0  {
723724		cfg .Rlimits  =  process .Rlimits 
724725	}
726+ 	if  process .IOPriority  !=  nil  {
727+ 		cfg .IOPriority  =  process .IOPriority 
728+ 	}
725729
726730	// Set misc properties. 
727731
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ type initConfig struct {
8282	NoNewPrivileges  bool                   `json:"no_new_privileges"` 
8383	ProcessLabel     string                 `json:"process_label"` 
8484	Rlimits          []configs.Rlimit       `json:"rlimits"` 
85+ 	IOPriority       * configs.IOPriority    `json:"io_priority"` 
8586
8687	// Properties that only exist in container config. 
8788	// FIXME: they are also passed in Config above. 
@@ -700,7 +701,7 @@ func setupScheduler(config *configs.Config) error {
700701	return  nil 
701702}
702703
703- func  setupIOPriority (config  * configs. Config ) error  {
704+ func  setupIOPriority (config  * initConfig ) error  {
704705	const  ioprioWhoPgrp  =  1 
705706
706707	ioprio  :=  config .IOPriority 
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 @@ -25,6 +25,20 @@ function teardown() {
2525	#  Check the process made from the exec command.
2626	runc exec  test_ioprio ionice
2727	[ " $status " -eq  0 ]
28- 
2928	[[ " $output " =  * ' best-effort: prio 4' *  ]]
29+ 
30+ 	#  Run exec with a different priority.
31+ 	proc=' 
32+ { 
33+ 	"terminal": false, 
34+ 	"ioPriority": { 
35+ 		"class": "IOPRIO_CLASS_RT", 
36+ 		"priority": 7 
37+ 	}, 
38+ 	"args": [ "/usr/bin/ionice" ], 
39+ 	"cwd": "/" 
40+ }'  
41+ 	runc exec  --process <( echo " $proc " ) 
42+ 	[ " $status " -eq  0 ]
43+ 	[[ " $output " =  * ' realtime: prio 7' *  ]]
3044}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments