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

add sandbox process operation relay API support#259

Merged
amshinde merged 5 commits intokata-containers:masterfrom
bergwolf:sandbox_api_2
May 7, 2018
Merged

add sandbox process operation relay API support#259
amshinde merged 5 commits intokata-containers:masterfrom
bergwolf:sandbox_api_2

Conversation

@bergwolf
Copy link
Copy Markdown
Member

@bergwolf bergwolf commented Apr 25, 2018

As described in the API design, we need to support sandbox.WaitProcess(), sandbox.WinsizeProcess(), sandbox.SignalProcess() and sandbox.IOStream() operations.

@sboeuf
Copy link
Copy Markdown

sboeuf commented Apr 25, 2018

Just adding do-not-merge for now, since we need to get #252 in first.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 25, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@992c895). Click here to learn what that means.
The diff coverage is 56.47%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #259   +/-   ##
=========================================
  Coverage          ?   65.26%           
=========================================
  Files             ?       76           
  Lines             ?     8185           
  Branches          ?        0           
=========================================
  Hits              ?     5342           
  Misses            ?     2269           
  Partials          ?      574
Impacted Files Coverage Δ
virtcontainers/agent.go 92.15% <ø> (ø)
virtcontainers/pkg/vcmock/sandbox.go 0% <0%> (ø)
virtcontainers/noop_agent.go 90% <100%> (ø)
virtcontainers/iostream.go 100% <100%> (ø)
virtcontainers/sandbox.go 69.41% <100%> (ø)
virtcontainers/kata_agent.go 29.84% <15.25%> (ø)
virtcontainers/hyperstart_agent.go 59.02% <7.69%> (ø)
virtcontainers/container.go 48.88% <77.77%> (ø)

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 992c895...410e5e6. Read the comment docs.

@sboeuf
Copy link
Copy Markdown

sboeuf commented May 1, 2018

#252 got merged, please rebase.

@bergwolf bergwolf force-pushed the sandbox_api_2 branch 4 times, most recently from 9b4d63e to 057b2cc Compare May 2, 2018 09:07
@bergwolf
Copy link
Copy Markdown
Member Author

bergwolf commented May 2, 2018

PR rebased. PTAL.

Copy link
Copy Markdown

@devimc devimc left a comment

Choose a reason for hiding this comment

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

nice patch! lgtm

@bergwolf
Copy link
Copy Markdown
Member Author

bergwolf commented May 3, 2018

CI green. @sboeuf @egernst @amshinde PTAL.

bergwolf added 4 commits May 4, 2018 15:38
It waits a process inside the container of a sandbox.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
It sends the signal to a process of a container, or all processes
inside a container.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
It sends tty resize request to the agent to resize a process's tty
window.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
It returns stdin, stdout and stderr stream of the specified process in
the container.

Fixes: kata-containers#258

Signed-off-by: Peng Tao <bergwolf@gmail.com>
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.

Overall looks okay to me. @amshinde can PTAL?

A few minor nits (looks like comment copy/paste needs update), but otherwise looks good. Sorry for delay, and hope we can merge very soon. Thanks @bergwolf

}

func (h *hyper) waitProcess(c *Container, processID string) (int32, error) {
// cc-agent does not support wait process
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.

s/cc-agent/hyperstart-agent?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

}

func (h *hyper) readProcessStderr(c *Container, processID string, data []byte) (int, error) {
// cc-agent does not support stderr read request
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.

s/cc-agent/hyperstart-agent?
same for all the other comments above...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

if err := waitForShim(c.process.Pid); err != nil {
// Force the container to be killed.
if err := c.sandbox.agent.killContainer(c.sandbox, *c, syscall.SIGKILL, true); err != nil {
if err := c.kill(syscall.SIGKILL, true); err != nil {
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 not just call into c.signalProcess here. c.kill api is not really required.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's a helper function for cases like this when we want to send signals to the container process itself. And it hides the detail that we use c.process.Token as process ID of the container process, useful because it's also called by KillContainer() in api.go.

Copy link
Copy Markdown
Member

@amshinde amshinde left a comment

Choose a reason for hiding this comment

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

I have just one comment here, overall looks good to me.

As @egernst pointed out, it should be hyperstart_agent instead of
cc-agent.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
@egernst
Copy link
Copy Markdown
Member

egernst commented May 6, 2018

@amshinde - PTAL at the update and merge if you're okay with the explanation provided?

)

type iostream struct {
sandbox *Sandbox
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 an iostream is only bounded to a container, so we don't need the sandbox here, and sandbox can be fetched from container.sandbox if needed.
We have lots of redundant struct fields in many places, maybe we can rework them later.

@WeiZhang555
Copy link
Copy Markdown
Member

WeiZhang555 commented May 7, 2018

LGTM

Approved with PullApprove

1 similar comment
@laijs
Copy link
Copy Markdown
Contributor

laijs commented May 7, 2018

LGTM

Approved with PullApprove

@laijs laijs dismissed amshinde’s stale review May 7, 2018 09:47

I found your comment has been resolved (reasonable answered, actually, IMO)

Copy link
Copy Markdown
Member

@amshinde amshinde left a comment

Choose a reason for hiding this comment

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

LGTM

@amshinde amshinde merged commit 81503d7 into kata-containers:master May 7, 2018
@bergwolf bergwolf deleted the sandbox_api_2 branch September 13, 2018 03:27
zklei pushed a commit to zklei/runtime that referenced this pull request Jun 13, 2019
If new vCPUs have been added, container cpuset cgroup *parents* MUST BE
updated, doesn't matter if the container already have a cgroup defined.
Updating cpuset cgroup *parents* won't affect to the container cpuset cgroup.

fixes kata-containers#259

Signed-off-by: Julio Montes <julio.montes@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.

7 participants