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

require conmon v2.0.1 #3792

Merged
merged 4 commits into from
Oct 29, 2019
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
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ env:
####
#### Cache-image names to test with (double-quotes around names are critical)
###
_BUILT_IMAGE_SUFFIX: "libpod-6296905679634432"
_BUILT_IMAGE_SUFFIX: "libpod-5642998972416000"
FEDORA_CACHE_IMAGE_NAME: "fedora-30-${_BUILT_IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-29-${_BUILT_IMAGE_SUFFIX}"
SPECIAL_FEDORA_CACHE_IMAGE_NAME: "xfedora-30-${_BUILT_IMAGE_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Install conmon
ENV CONMON_COMMIT 6f3572558b97bc60dd8f8c7f0807748e6ce2c440
ENV CONMON_COMMIT 65fe0226d85b69fc9e527e376795c9791199153d
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now, but consider changing this over to the tag for the release like 'v2.0.2' then below I think (didn't try it) you can do git checkout tags/CONMON_COMMIT, at least that's the theory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think actually the next step is to enable pulling conmon from a package (like the other vms do) instead of by git commit

RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/containers/conmon.git "$GOPATH/src/github.com/containers/conmon.git" \
Expand Down
45 changes: 38 additions & 7 deletions libpod/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ var (
// DefaultDetachKeys is the default keys sequence for detaching a
// container
DefaultDetachKeys = "ctrl-p,ctrl-q"

// minConmonMajor is the major version required for conmon
minConmonMajor = 2

// minConmonMinor is the minor version required for conmon
minConmonMinor = 0

// minConmonPatch is the sub-minor version required for conmon
minConmonPatch = 1
)

// A RuntimeOption is a functional option which alters the Runtime created by
Expand Down Expand Up @@ -783,6 +792,7 @@ func getLockManager(runtime *Runtime) (lock.Manager, error) {
// probeConmon calls conmon --version and verifies it is a new enough version for
// the runtime expectations podman currently has
func probeConmon(conmonBinary string) error {
versionFormatErr := "conmon version changed format"
cmd := exec.Command(conmonBinary, "--version")
var out bytes.Buffer
cmd.Stdout = &out
Expand All @@ -794,19 +804,40 @@ func probeConmon(conmonBinary string) error {

matches := r.FindStringSubmatch(out.String())
if len(matches) != 4 {
return errors.Wrapf(err, "conmon version changed format")
return errors.Wrapf(err, versionFormatErr)
}
major, err := strconv.Atoi(matches[1])
if err != nil || major < 1 {
if err != nil {
return errors.Wrapf(err, versionFormatErr)
}
if major < minConmonMajor {
return define.ErrConmonOutdated
}
// conmon used to be shipped with CRI-O, and was versioned along with it.
// even though the conmon that came with crio-1.9 to crio-1.15 has a higher
// version number than conmon 1.0.0, 1.0.0 is newer, so we need this check
if major > minConmonMajor {
return nil
}

minor, err := strconv.Atoi(matches[2])
if err != nil || minor > 9 {
if err != nil {
return errors.Wrapf(err, versionFormatErr)
}
if minor < minConmonMinor {
return define.ErrConmonOutdated
}
if minor > minConmonMinor {
return nil
}

patch, err := strconv.Atoi(matches[3])
if err != nil {
return errors.Wrapf(err, versionFormatErr)
}
if patch < minConmonPatch {
return define.ErrConmonOutdated
}
if patch > minConmonPatch {
return nil
}

return nil
}
Expand Down Expand Up @@ -866,7 +897,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) {

if !foundConmon {
if foundOutdatedConmon {
return errors.Wrapf(define.ErrConmonOutdated, "please update to v1.0.0 or later")
return errors.Errorf("please update to v%d.%d.%d or later: %v", minConmonMajor, minConmonMinor, minConmonPatch, define.ErrConmonOutdated)
}
return errors.Wrapf(define.ErrInvalidArg,
"could not find a working conmon binary (configured options: %v)",
Expand Down