Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

cli: implement update command#270

Merged
egernst merged 3 commits intokata-containers:masterfrom
devimc:command/update
May 8, 2018
Merged

cli: implement update command#270
egernst merged 3 commits intokata-containers:masterfrom
devimc:command/update

Conversation

@devimc
Copy link
Copy Markdown

@devimc devimc commented Apr 27, 2018

Update command is used to update container's resources at run time.
All constraints are applied inside the VM to each container cgroup.
By now only CPU constraints are fully supported, vCPU are hot added
or removed depending of the new constraint.

fixes #189

Signed-off-by: Julio Montes julio.montes@intel.com

@devimc devimc force-pushed the command/update branch 2 times, most recently from 1e0059a to 0d15561 Compare May 2, 2018 15:10
@devimc devimc changed the title [WIP] implement update command implement update command May 2, 2018
@devimc devimc changed the title implement update command cli: implement update command May 2, 2018
@devimc
Copy link
Copy Markdown
Author

devimc commented May 2, 2018

@kata-containers/runtime please take a look

@devimc devimc force-pushed the command/update branch 3 times, most recently from 4267c9f to bee9560 Compare May 2, 2018 17:34
}

// Fetch the container.
c, err := p.findContainer(containerID)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please make UpdateContainer part of the VCSandbox interface and implement UpdateContainer() here as a wrapper of it. You can move p.findContainer() and c.update() to sandbox.UpdateContainer().

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will do :)

},
"blockIO": {
"weight": 0
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

missing pids?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't think so, it's base on runC implementation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a bug in runc? --pids-limit and --l3-cache-schema were added after the initial runc update implementation and it seems the developer forgot to add them to the resources file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We do read pid limit at https://github.com/kata-containers/runtime/pull/270/files#diff-1cc31db47bce8b7af5fda9d984c048e6R162. So I think we should at least add pids here. l3-cache-schema may be left out since it is not part of specs.LinuxResources anyway.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

good catch!

@devimc devimc force-pushed the command/update branch from bee9560 to 18d05d4 Compare May 3, 2018 15:16
@codecov
Copy link
Copy Markdown

codecov bot commented May 3, 2018

Codecov Report

Merging #270 into master will increase coverage by 1.31%.
The diff coverage is 70.49%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #270      +/-   ##
==========================================
+ Coverage    64.4%   65.71%   +1.31%     
==========================================
  Files          85       76       -9     
  Lines        8214     8197      -17     
==========================================
+ Hits         5290     5387      +97     
+ Misses       2361     2228     -133     
- Partials      563      582      +19
Impacted Files Coverage Δ
cli/main.go 88% <ø> (ø) ⬆️
virtcontainers/agent.go 92.15% <ø> (ø) ⬆️
virtcontainers/implementation.go 0% <0%> (ø) ⬆️
virtcontainers/pkg/vcmock/sandbox.go 0% <0%> (ø) ⬆️
virtcontainers/pkg/vcmock/mock.go 94.93% <0%> (-5.07%) ⬇️
virtcontainers/hyperstart_agent.go 60.42% <0%> (+1.39%) ⬆️
virtcontainers/kata_agent.go 32.43% <0%> (+2.59%) ⬆️
virtcontainers/noop_agent.go 86.66% <100%> (-3.34%) ⬇️
virtcontainers/container.go 45.51% <39.47%> (-3.37%) ⬇️
virtcontainers/sandbox.go 67.64% <60%> (+0.28%) ⬆️
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa848ba...2b2aeab. Read the comment docs.

@devimc devimc force-pushed the command/update branch from 18d05d4 to 56a2299 Compare May 3, 2018 15:30
@devimc
Copy link
Copy Markdown
Author

devimc commented May 3, 2018

@bergwolf changes applied, thanks

@devimc devimc force-pushed the command/update branch from 56a2299 to 9a934be Compare May 3, 2018 15:32
Copy link
Copy Markdown
Member

@bergwolf bergwolf left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @devimc !

packages = ["pkg/cover"]
revision = "b0c4c6d0583aae4e3b5d12b6ec47767670548cc4"

[[projects]]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this be part of the prior commit, @devimc ?

}

func (h *hyper) updateContainer(sandbox *Sandbox, c Container, resources specs.LinuxResources) error {
// cc-agent does not support update
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be hyperstart_agent ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmmm, so weird, this file is written for hyperstart agent but the comment is saying cc-agent.

I'm confused a bit, is this correct? @bergwolf

Copy link
Copy Markdown
Member

@WeiZhang555 WeiZhang555 May 7, 2018

Choose a reason for hiding this comment

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

Oh, I believe this is a typo now. Check: https://github.com/kata-containers/runtime/pull/259/files#diff-d4339baeea8e93444b3ddc3e97b53c87R806

It's already been fixed in #259 now

StatusContainer(sandboxID, containerID string) (ContainerStatus, error)
StopContainer(sandboxID, containerID string) (VCContainer, error)
ProcessListContainer(sandboxID, containerID string, options ProcessListOptions) (ProcessList, error)
UpdateContainer(sandboxID, containerID string, resources specs.LinuxResources) error
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this API? I think sandbox.UpdateContainer is enough for us.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we need it to write unit tests

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

see cli/update_test.go

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's OK for now. I think we have lots of exported functions just used for test, hope we can find a way to remove them and keep the test cases at the same time later.
It's another topic though. This part looks good for now.

@devimc devimc force-pushed the command/update branch from 9a934be to e4c888b Compare May 4, 2018 15:29
@devimc
Copy link
Copy Markdown
Author

devimc commented May 4, 2018

@egernst changes applied, thanks

Copy link
Copy Markdown
Member

@egernst egernst left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @devimc.

@WeiZhang555 - can you please take a look @ the update and merge if you are okay with the changes?

@WeiZhang555
Copy link
Copy Markdown
Member

Codes LGTM. Only a typo left s/cc-agent/hyperstart-agent/

So anyone please feel free to merge this after the typo is fixed.

@devimc devimc force-pushed the command/update branch from e4c888b to f7c35e7 Compare May 7, 2018 13:48
@devimc
Copy link
Copy Markdown
Author

devimc commented May 7, 2018

@WeiZhang555 changes applied, thanks

@egernst
Copy link
Copy Markdown
Member

egernst commented May 8, 2018

@devimc please rebase and lets move forward to merge after...

go-units package is used to convert integers to memory
units, for example 1024 -> 1G

Signed-off-by: Julio Montes <julio.montes@intel.com>
@devimc devimc force-pushed the command/update branch from f7c35e7 to 0993a47 Compare May 8, 2018 12:22
Update command is used to update container's resources at run time.
All constraints are applied inside the VM to each container cgroup.
By now only CPU constraints are fully supported, vCPU are hot added
or removed depending of the new constraint.

fixes kata-containers#189

Signed-off-by: Julio Montes <julio.montes@intel.com>
This new version of kata-agent brings support for
updating resources and cpuset cgroups

Shortlog:
28cf91a grpc: implement update command
d96b8e1 grpc: update cpuset cgroup
4bcacdc network: Don't remove network routes or DNS when destroying sandbox
1f5cf20 network: Don't store the network info as pointers if slices used
8f828bb uevent: Fix netlink error while assigning pid in netlink client
093f61b agent: add grpc tracer UT
33bd601 agent: add server interceptor to log grpc requests
134d5d5 test: add start/stop grpc server UT
7e94246 agent: track grpc server
9fb8024 UT: add tests for channel
bea6183 agent: wait serial channel to be ready before reading
f8c8c4c agent: accept grpc connections multiple times

Signed-off-by: Julio Montes <julio.montes@intel.com>
@devimc devimc force-pushed the command/update branch from 0993a47 to 2b2aeab Compare May 8, 2018 12:29
@egernst egernst merged commit f6544a3 into kata-containers:master May 8, 2018
@devimc devimc deleted the command/update branch May 9, 2018 15:38
zklei pushed a commit to zklei/runtime that referenced this pull request Jun 13, 2019
Convert all non-string types into strings prior to logging to avoid
attempting to display non-string types with the `%q` format verb.

Fixes kata-containers#270.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the update command

4 participants