Skip to content

Add pause/resume implementation - #807

Merged
crosbymichael merged 1 commit into
containerd:masterfrom
estesp:add-pause-resume
May 8, 2017
Merged

Add pause/resume implementation#807
crosbymichael merged 1 commit into
containerd:masterfrom
estesp:add-pause-resume

Conversation

@estesp

@estesp estesp commented May 5, 2017

Copy link
Copy Markdown
Member

This adds pause and resume to containerd's execution service and the
same commands to the ctr client.

Fixes: #794
Signed-off-by: Phil Estes estesp@linux.vnet.ibm.com

@estesp

estesp commented May 5, 2017

Copy link
Copy Markdown
Member Author

Open questions:

  • Names: I picked pause and unpause; no strong opinion vs. resume (now pause/resume)
  • Code does not check for current process state to 'error' if pausing a paused container or unpausing an unpaused container. Is that necessary? Should we let higher level engines choose to add that strict checking?
  • Windows does not implement pause/unpause. I personally don't know if it's possible or not so I stubbed it out as I don't see capabilities in the hcs or process implementation in the codebase. @jhowardmsft
Comment thread windows/runtime.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually windows do support pause/resume if the container is running under HyperV. It's a matter of calling Pause()/Resume() on the hcsshim.Container type.

You can check that a container was started using HyperV by checking the UseHyperV flag within the windows runtime container object.

@mlaventure

Copy link
Copy Markdown
Contributor

Thanks to taking care of this one!

@mlaventure

Copy link
Copy Markdown
Contributor

Code does not check for current process state to 'error' if pausing a paused container or unpausing an unpaused container. Is that necessary?

We just need consistency across runtime I think. We need to decide to either error or on that case or silently succeed.

@mlaventure

Copy link
Copy Markdown
Contributor

Names: I picked pause and unpause; no strong opinion vs. resume

Looks like both the Linux and Windows Shim are using Resume maybe do the same for consistency.

@codecov-io

codecov-io commented May 5, 2017

Copy link
Copy Markdown

Codecov Report

Merging #807 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #807   +/-   ##
=======================================
  Coverage   59.26%   59.26%           
=======================================
  Files           5        5           
  Lines         739      739           
=======================================
  Hits          438      438           
  Misses        198      198           
  Partials      103      103

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 73466a2...9141087. Read the comment docs.

@estesp
estesp force-pushed the add-pause-resume branch from a92e621 to 9a393cc Compare May 5, 2017 16:24
@estesp estesp changed the title Add pause/unpause implementation May 5, 2017
@estesp

estesp commented May 5, 2017

Copy link
Copy Markdown
Member Author

@mlaventure thanks! Updated with a Windows implementation, but I have no way to test.

As you mentioned, given the runtimes were "resume," they are all aligned to use the same words "pause" and "resume" now.

Only remaining issue is to decide about checking state and having an error for "invalid" state transitions.

@mlaventure

Copy link
Copy Markdown
Contributor

@estesp I realized that I actually never tested the HyperV version. So I'll do that later, since it may not work at all 😅

Comment thread runtime.go Outdated

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.

Is there a reason why you placed these methods on the Runtime and not on the Container interfaces?

This adds pause and unpause to containerd's execution service and the
same commands to the `ctr` client.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
@estesp
estesp force-pushed the add-pause-resume branch from 9a393cc to 9141087 Compare May 6, 2017 20:06
@estesp

estesp commented May 6, 2017

Copy link
Copy Markdown
Member Author

@crosbymichael obviously a newbie error.. just pushed update with Pause/Resume attached to container operations. This forced (maybe incorrectly?) me to add Pause and Resume to base Container type, so LinuxContainer now is possibly an unnecessary type.

This all hinges on someone validating that pause/resume works for the UseHyperV-configured Windows containers, as that check is now in the base Windows container impl. of Pause and Resume

@mlaventure

Copy link
Copy Markdown
Contributor

@estesp Pause/Resume is implemented and AFAIK working within docker.

I'm fine with this being merged without me having the time to test it on Windows, if it is broken, I'll fix it :)

@crosbymichael

Copy link
Copy Markdown
Member

LGTM

1 similar comment
@dqminh

dqminh commented May 8, 2017

Copy link
Copy Markdown
Member

LGTM

@crosbymichael
crosbymichael merged commit a1d5fc6 into containerd:master May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants