aboutsummaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-10-29 17:44:52 +0100
committerGitHub <noreply@github.com>2019-10-29 17:44:52 +0100
commit59582c55b798f0a2d086981ca9a8ddd8314fd0c2 (patch)
tree543493ed3fafc42901be3f1afbbff2620a42a8cd /libpod/runtime.go
parenta56131fef4a82824b397c94f6b7edcdb24769624 (diff)
parent49e251fc57447f79632ca5ddf37847c86ade2271 (diff)
downloadpodman-59582c55b798f0a2d086981ca9a8ddd8314fd0c2.tar.gz
podman-59582c55b798f0a2d086981ca9a8ddd8314fd0c2.tar.bz2
podman-59582c55b798f0a2d086981ca9a8ddd8314fd0c2.zip
Merge pull request #3792 from haircommander/minimum-conmon
require conmon v2.0.1
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go45
1 files changed, 38 insertions, 7 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index a06b2bb51..0405a9b85 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -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
@@ -788,6 +797,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
@@ -799,19 +809,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
}
@@ -871,7 +902,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)",