Skip to content

Commit

Permalink
nydusify: disable digest validate and use direct mode for v6
Browse files Browse the repository at this point in the history
Signed-off-by: zyfjeff <tianqian.zyf@alibaba-inc.com>
  • Loading branch information
zyfjeff authored and yawqi committed Jun 8, 2022
1 parent 26137c3 commit 8f78162
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
27 changes: 19 additions & 8 deletions contrib/nydusify/pkg/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Opt struct {
BackendType string
BackendConfig string
ExpectedArch string
ImageVersion string
}

// Checker validates Nydus image manifest, bootstrap and mounts filesystem
Expand Down Expand Up @@ -105,6 +106,14 @@ func (checker *Checker) Check(ctx context.Context) error {
return errors.Wrap(err, "output image information")
}

mode := "cache"
digestValidate := true
if checker.ImageVersion == "6" {
mode = "direct"
digestValidate = false

}

rules := []rule.Rule{
&rule.ManifestRule{
SourceParsed: sourceParsed,
Expand All @@ -124,14 +133,16 @@ func (checker *Checker) Check(ctx context.Context) error {
Source: checker.Source,
SourceMountPath: filepath.Join(checker.WorkDir, "fs/source_mounted"),
NydusdConfig: tool.NydusdConfig{
NydusdPath: checker.NydusdPath,
BackendType: checker.BackendType,
BackendConfig: checker.BackendConfig,
BootstrapPath: filepath.Join(checker.WorkDir, "nydus_bootstrap"),
ConfigPath: filepath.Join(checker.WorkDir, "fs/nydusd_config.json"),
BlobCacheDir: filepath.Join(checker.WorkDir, "fs/nydus_blobs"),
MountPath: filepath.Join(checker.WorkDir, "fs/nydus_mounted"),
APISockPath: filepath.Join(checker.WorkDir, "fs/nydus_api.sock"),
NydusdPath: checker.NydusdPath,
BackendType: checker.BackendType,
BackendConfig: checker.BackendConfig,
BootstrapPath: filepath.Join(checker.WorkDir, "nydus_bootstrap"),
ConfigPath: filepath.Join(checker.WorkDir, "fs/nydusd_config.json"),
BlobCacheDir: filepath.Join(checker.WorkDir, "fs/nydus_blobs"),
MountPath: filepath.Join(checker.WorkDir, "fs/nydus_mounted"),
APISockPath: filepath.Join(checker.WorkDir, "fs/nydus_api.sock"),
Mode: mode,
DigestValidate: digestValidate,
},
},
}
Expand Down
6 changes: 4 additions & 2 deletions contrib/nydusify/pkg/checker/tool/nydusd.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ type NydusdConfig struct {
BlobCacheDir string
APISockPath string
MountPath string
Mode string
DigestValidate bool
}

// Nydusd runs nydusd binary.
Expand All @@ -55,14 +57,14 @@ var configTpl = `
}
}
},
"mode": "cached",
"mode": "{{.Mode}}",
"iostats_files": false,
"fs_prefetch": {
"enable": {{.EnablePrefetch}},
"threads_count": 10,
"merging_size": 131072
},
"digest_validate": true,
"digest_validate": {{.DigestValidate}},
"enable_xattr": true
}
`
Expand Down
1 change: 1 addition & 0 deletions contrib/nydusify/tests/nydusify.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func (nydusify *Nydusify) Check(t *testing.T) {
BackendType: nydusify.backendType,
BackendConfig: nydusify.backendConfig,
ExpectedArch: "amd64",
ImageVersion: nydusify.imageVersion,
})
assert.Nil(t, err)

Expand Down

0 comments on commit 8f78162

Please sign in to comment.