Skip to content

Commit

Permalink
[bugfix] convertor: turbo error when vsize != 64
Browse files Browse the repository at this point in the history
Signed-off-by: zhuangbowei.zbw <[email protected]>
  • Loading branch information
WaberZhuang committed Oct 25, 2024
1 parent 0c2f057 commit 62ab766
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@ jobs:
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
# TODO(fuweid): remove the env GO111MODULE=off in new version of go
- name: install dependencies
shell: bash
env:
GO111MODULE: off
GO111MODULE: on
run: |
echo "::group:: install dependencies"
go get -u -v github.com/vbatts/git-validation
go get -u -v github.com/kunalkushwaha/ltag
go install -v github.com/vbatts/git-validation@latest
go install -v github.com/kunalkushwaha/ltag@latest
echo "::endgroup::"
- name: DCO checker
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-userspace-convertor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
/opt/overlaybd/snapshotter/convertor -r localhost:5000/redis -i 7.2.3 --overlaybd 7.2.3_overlaybd --turboOCI 7.2.3_turbo
bash run_container.sh localhost:5000/redis:7.2.3_overlaybd
bash run_container.sh localhost:5000/redis:7.2.3_turbo
/opt/overlaybd/snapshotter/convertor -r localhost:5000/redis -i 7.2.3 --overlaybd 7.2.3_overlaybd_256 --turboOCI 7.2.3_turbo_256 --vsize 256
bash run_container.sh localhost:5000/redis:7.2.3_overlaybd_256
bash run_container.sh localhost:5000/redis:7.2.3_turbo_256
- name: CI - uconv E2E with digest input
working-directory: ci/scripts
Expand Down
3 changes: 3 additions & 0 deletions ci/scripts/run_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# rpull and run on-demand

set -x

image=$1
container_name=${2:-test}

Expand All @@ -11,6 +13,7 @@ exit_code=0
if ! ctr run -d --net-host --snapshotter=overlaybd "${image}" "${container_name}"; then
exit_code=1
fi
lsblk
if ! ctr t ls | grep "${container_name}"; then
exit_code=1
fi
Expand Down
17 changes: 10 additions & 7 deletions cmd/convertor/builder/turboOCI_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (e *turboOCIBuilderEngine) DownloadLayer(ctx context.Context, idx int) erro

func (e *turboOCIBuilderEngine) BuildLayer(ctx context.Context, idx int) error {
layerDir := e.getLayerDir(idx)
if err := e.create(ctx, layerDir, e.mkfs && (idx == 0)); err != nil {
if err := e.create(ctx, idx); err != nil {
return err
}
e.overlaybdConfig.Upper = sn.OverlayBDBSConfigUpper{
Expand Down Expand Up @@ -261,17 +261,20 @@ func (e *turboOCIBuilderEngine) createIdentifier(idx int) error {
return nil
}

func (e *turboOCIBuilderEngine) create(ctx context.Context, dir string, mkfs bool) error {
vsizeGB := 64
if mkfs {
func (e *turboOCIBuilderEngine) create(ctx context.Context, idx int) error {
vsizeGB := 64 // use default baselayer
if e.mkfs {
vsizeGB = e.vsize
}
opts := []string{"-s", fmt.Sprintf("%d", vsizeGB), "--turboOCI"}
if mkfs && e.fstype != "erofs" {
opts = append(opts, "--mkfs")

if e.mkfs && idx == 0 {
logrus.Infof("mkfs for baselayer, vsize: %d GB", vsizeGB)
if e.fstype != "erofs" {
opts = append(opts, "--mkfs")
}
}
return utils.Create(ctx, dir, opts...)
return utils.Create(ctx, e.getLayerDir(idx), opts...)
}

func (e *turboOCIBuilderEngine) apply(ctx context.Context, dir string) error {
Expand Down

0 comments on commit 62ab766

Please sign in to comment.