Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support net priority flag #1576

Merged
merged 1 commit into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apis/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,10 @@ definitions:
QuotaID:
type: "string"
description: "set disk quota by specified quota id, if id < 0, it means pouchd alloc a unique quota id"
NetPriority:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NetPriority seem a property of network endpoint. A container may have many endpoints, we may apply different Priorities to different endpoints. Can we consider the situation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we not implement in sever, so we just add a flag called NetPriority to prepare

description: "net priority."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add more description of this field? More detailed content makes more people know more about the great things you are doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it will be TODO things.

type: "integer"
default: 0

ContainerCreateResp:
description: "response returned by daemon when container create successfully"
Expand Down
5 changes: 5 additions & 0 deletions apis/types/container_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cli/common_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func addCommonFlags(flagSet *pflag.FlagSet) *container {
flagSet.StringVar(&c.richMode, "rich-mode", "", "Choose one rich container mode. dumb-init(default), systemd, sbin-init")
flagSet.StringVar(&c.initScript, "initscript", "", "Initial script executed in container")
flagSet.StringVar(&c.shmSize, "shm-size", "", "Size of /dev/shm, default value is 64MB")
flagSet.Int64Var(&c.netPriority, "net-priority", 0, "net priority")

// cgroup
flagSet.StringVarP(&c.cgroupParent, "cgroup-parent", "", "", "Optional parent cgroup for the container")
Expand Down
2 changes: 2 additions & 0 deletions cli/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type container struct {
ulimit Ulimit
pidsLimit int64
shmSize string
netPriority int64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason to use int64?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swagger generate with

      type: "integer"
      default: 0

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanna set a specific type, maybe you can consider the following way:

      BlkioWeight:
        description: "Block IO weight (relative weight), need CFQ IO Scheduler enable."
        type: "integer"
        format: "uint16"
        x-nullable: false
        minimum: 0
        maximum: 1000


// log driver and log option
logDriver string
Expand Down Expand Up @@ -203,6 +204,7 @@ func (c *container) config() (*types.ContainerCreateConfig, error) {
DiskQuota: diskQuota,
QuotaID: c.quotaID,
SpecAnnotation: specAnnotation,
NetPriority: c.netPriority,
},

HostConfig: &types.HostConfig{
Expand Down