-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(zfspv): rounding off the volume size to Gi and Mi
ZFS does not create the zvol if volume size is not multiple of the volblocksize. There are use cases where customer will create a PVC with size as 5G, which will be 5 * 1000 * 1000 * 1000 bytes and this is not the multiple of default volblocksize 8k. In ZFS, volblocksize and recordsize must be power of 2 from 512B to 1M, so keeping the size in the form of Gi or Mi should be sufficient to make volsize multiple of volblocksize/recordsize. Signed-off-by: Pawan <pawan@mayadata.io>
- Loading branch information
1 parent
cd4a0de
commit 479fe46
Showing
21 changed files
with
4,915 additions
and
7 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 @@ | ||
rounding off the volume size to Gi and Mi |
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
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
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,44 @@ | ||
/* | ||
Copyright 2020 The OpenEBS Authors. | ||
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 driver | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestRoundOff(t *testing.T) { | ||
|
||
tests := map[string]struct { | ||
input int64 | ||
expected int64 | ||
}{ | ||
"Minimum allocatable is 1Mi": {input: 1, expected: Mi}, | ||
"Minimum allocatable is 1Mi": {input: 1, expected: Mi}, | ||
"roundOff to same Mi size": {input: Mi, expected: Mi}, | ||
"roundOff to nearest Mi": {input: Mi + 1, expected: Mi * 2}, | ||
"roundOff to same Gi size": {input: Gi, expected: Gi}, | ||
"roundOff to nearest Gi": {input: Gi + 1, expected: Gi * 2}, | ||
} | ||
|
||
for name, test := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
assert.Equal(t, test.expected, getRoundedCapacity(test.input)) | ||
}) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.