-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure minimum kernel version for thin_ls
Ensure that kernel >= 4.4.0 or RHEL/Centos 7 kernel >= 3.10.0-366 exists before starting the thin pool watcher. Prior versions have a bug in which reserving and releasing the metadata snapshot can cause thin pool corruption.
- Loading branch information
Andy Goldstein
committed
Aug 4, 2016
1 parent
c6c06d4
commit d1e2041
Showing
2 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2016 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package docker | ||
|
||
import "testing" | ||
|
||
func TestEnsureThinLsKernelVersion(t *testing.T) { | ||
tests := []struct { | ||
version string | ||
ok bool | ||
}{ | ||
{"4.4.0-31-generic", true}, | ||
{"4.4.1", true}, | ||
{"4.6.4-301.fc24.x86_64", true}, | ||
{"3.10.0-327.22.2.el7.x86_64", false}, | ||
{"3.10.0-366.el7.x86_64", true}, | ||
{"3.10.0.el7.abc", false}, | ||
{"3.10.0-abc.el7.blarg", false}, | ||
{"3.10.0-367.el7.x86_64", true}, | ||
{"3.10.0-366.x86_64", false}, | ||
{"3.10.1-1.el7.x86_64", true}, | ||
{"2.0.36", false}, | ||
{"2.1", false}, | ||
{"4.0.0.el7.x86_64", false}, | ||
} | ||
|
||
for _, test := range tests { | ||
err := ensureThinLsKernelVersion(test.version) | ||
if err != nil && test.ok { | ||
t.Errorf("%s: expected no error, got %v", test.version, err) | ||
} else if err == nil && !test.ok { | ||
t.Errorf("%s: expected an error", test.version) | ||
} | ||
} | ||
} |