@@ -42,6 +42,8 @@ var generateFlags = []cli.Flag{
4242 cli.Uint64Flag {Name : "linux-mem-swap" , Usage : "total memory limit (memory + swap) (in bytes)" },
4343 cli.Uint64Flag {Name : "linux-mem-swappiness" , Usage : "how aggressive the kernel will swap memory pages (Range from 0 to 100)" },
4444 cli.StringFlag {Name : "linux-mems" , Usage : "list of memory nodes in the cpuset (default is to use any available memory node)" },
45+ cli.IntFlag {Name : "linux-network-classid" , Usage : "specifies class identifier tagged by container's network packets" },
46+ cli.StringSliceFlag {Name : "linux-network-priorities" , Usage : "specifies priorities of network traffic" },
4547 cli.Int64Flag {Name : "linux-pids-limit" , Usage : "maximum number of PIDs" },
4648 cli.Uint64Flag {Name : "linux-realtime-period" , Usage : "CPU period to be used for realtime scheduling (in usecs)" },
4749 cli.Uint64Flag {Name : "linux-realtime-runtime" , Usage : "the time realtime scheduling may use (in usecs)" },
@@ -420,6 +422,25 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
420422 g .SetLinuxResourcesMemorySwappiness (context .Uint64 ("linux-mem-swappiness" ))
421423 }
422424
425+ if context .IsSet ("linux-network-classid" ) {
426+ g .SetLinuxResourcesNetworkClassID (uint32 (context .Int ("linux-network-classid" )))
427+ }
428+
429+ if context .IsSet ("linux-network-priorities" ) {
430+ priorities := context .StringSlice ("linux-network-priorities" )
431+ for _ , p := range priorities {
432+ name , priority , err := parseNetworkPriority (p )
433+ if err != nil {
434+ return err
435+ }
436+ if priority == - 1 {
437+ g .DropLinuxResourcesNetworkPriorities (name )
438+ } else {
439+ g .AddLinuxResourcesNetworkPriorities (name , uint32 (priority ))
440+ }
441+ }
442+ }
443+
423444 err := addSeccomp (context , g )
424445 return err
425446}
@@ -472,6 +493,21 @@ func parseHook(s string) (string, []string) {
472493 return path , args
473494}
474495
496+ func parseNetworkPriority (np string ) (string , int32 , error ) {
497+ var err error
498+
499+ parts := strings .Split (np , ":" )
500+ if len (parts ) != 2 {
501+ return "" , 0 , fmt .Errorf ("invalid value %v for --linux-network-priorities" , np )
502+ }
503+ priority , err := strconv .Atoi (parts [1 ])
504+ if err != nil {
505+ return "" , 0 , err
506+ }
507+
508+ return parts [0 ], int32 (priority ), nil
509+ }
510+
475511func parseTmpfsMount (s string ) (string , []string , error ) {
476512 var dest string
477513 var options []string
0 commit comments