@@ -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)" },
@@ -424,6 +426,25 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
424426 g .SetLinuxResourcesMemorySwappiness (context .Uint64 ("linux-mem-swappiness" ))
425427 }
426428
429+ if context .IsSet ("linux-network-classid" ) {
430+ g .SetLinuxResourcesNetworkClassID (uint32 (context .Int ("linux-network-classid" )))
431+ }
432+
433+ if context .IsSet ("linux-network-priorities" ) {
434+ priorities := context .StringSlice ("linux-network-priorities" )
435+ for _ , p := range priorities {
436+ name , priority , err := parseNetworkPriority (p )
437+ if err != nil {
438+ return err
439+ }
440+ if priority == - 1 {
441+ g .DropLinuxResourcesNetworkPriorities (name )
442+ } else {
443+ g .AddLinuxResourcesNetworkPriorities (name , uint32 (priority ))
444+ }
445+ }
446+ }
447+
427448 err := addSeccomp (context , g )
428449 return err
429450}
@@ -476,6 +497,21 @@ func parseHook(s string) (string, []string) {
476497 return path , args
477498}
478499
500+ func parseNetworkPriority (np string ) (string , int32 , error ) {
501+ var err error
502+
503+ parts := strings .Split (np , ":" )
504+ if len (parts ) != 2 {
505+ return "" , 0 , fmt .Errorf ("invalid value %v for --linux-network-priorities" , np )
506+ }
507+ priority , err := strconv .Atoi (parts [1 ])
508+ if err != nil {
509+ return "" , 0 , err
510+ }
511+
512+ return parts [0 ], int32 (priority ), nil
513+ }
514+
479515func parseTmpfsMount (s string ) (string , []string , error ) {
480516 var dest string
481517 var options []string
0 commit comments