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

Use CRIU VERSION RPC if available #1535

Merged
merged 5 commits into from
Aug 5, 2017
Merged

Conversation

adrianreber
Copy link
Contributor

With this runC also uses RPC to ask CRIU for its version. CRIU supports a VERSION RPC since CRIU 3.0 and using the RPC interface does not require parsing the console output of CRIU (which could change anytime).

For older CRIU versions which do not yet have the VERSION RPC runC falls back to its old CRIU output parsing mode.

Once CRIU 3.0 is the minimum version required for runC the old code can be removed.

@dqminh dqminh added this to the 1.1.0 milestone Jul 27, 2017
@adrianreber adrianreber force-pushed the master branch 3 times, most recently from 6ec21ef to cdc6d98 Compare August 1, 2017 15:53
@mrunalp
Copy link
Contributor

mrunalp commented Aug 1, 2017

@avagin ping

// If the version of criu has already been determined there is no need
// to ask criu for the version again. Use the value from c.criuVersion.
if c.criuVersion == 0 {
var x, y, z int
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be better to introduce a function for this code?


out, err := exec.Command(c.criuPath, "-V").Output()
Copy link
Contributor

Choose a reason for hiding this comment

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

In a previous patch you shifted this code and now you shifted it back. Try to avoid such things.

The checkCriuVersion function used a string to specify the minimum
version required. This is more comfortable for an external interface
but for an internal function this added unnecessary complexity. This
changes to version string like '1.5.2' to an integer like 10502. This is
already the format used internally in the function.

Signed-off-by: Adrian Reber <areber@redhat.com>
If the version of criu has already been determined there is no need to
ask criu for the version again. Use the value from c.criuVersion.

v2:
 * reduce unnecessary code movement in the patch series
 * factor out the criu version parsing into a separate function

Signed-off-by: Adrian Reber <areber@redhat.com>
To use the CRIU VERSION RPC the criuSwrk function is adapted to work
with CriuOpts set to 'nil' as CriuOpts is not required for the VERSION
RPC.

Also do not print c.criuVersion if it is '0' as the first RPC call will
always be the VERSION call and only after that the version will be
known.

Signed-off-by: Adrian Reber <areber@redhat.com>
Update criurpc.proto for the upcoming VERSION RPC.

This includes lazy_pages for the upcoming lazy migration support.

Signed-off-by: Adrian Reber <areber@redhat.com>
With this runC also uses RPC to ask CRIU for its version. CRIU supports
a VERSION RPC since CRIU 3.0 and using the RPC interface does not
require parsing the console output of CRIU (which could change anytime).

For older CRIU versions which do not yet have the VERSION RPC runC falls
back to its old CRIU output parsing mode.

Once CRIU 3.0 is the minimum version required for runC the old code can
be removed.

v2:
 * adapt to changes in the previous patches based on the review

Signed-off-by: Adrian Reber <areber@redhat.com>
@adrianreber
Copy link
Contributor Author

@avagin: Thanks for having a look. You are right, there was unnecessary code movement which I removed and I also moved the version parsing into a separate function.

@adrianreber
Copy link
Contributor Author

Not sure why travis failed. My other PR (#1541) which includes these patches was successful. So I guess the failure is unrelated to this PR?

Any other comments?

@avagin
Copy link
Contributor

avagin commented Aug 4, 2017

I'm agree that the failure is unrelated.

--- FAIL: TestNotifyMemoryPressure (0.00s)
	notify_linux_test.go:99: expected event control to be closed, but received error errno 0
....

LGTM

Approved with PullApprove

@cyphar
Copy link
Member

cyphar commented Aug 5, 2017

I've retriggered the CI, and will merge if it succeeds.

@cyphar
Copy link
Member

cyphar commented Aug 5, 2017

LGTM.

Approved with PullApprove

@cyphar cyphar merged commit 5d386f6 into opencontainers:master Aug 5, 2017
cyphar added a commit that referenced this pull request Aug 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants