Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support generating separate blob for prefetched files #1629

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions smoke/tests/native_layer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (n *NativeLayerTestSuite) TestMakeLayers() test.Generator {
ctx.Runtime.RafsMode = scenario.GetString(paramRafsMode)
ctx.Runtime.EnablePrefetch = scenario.GetBool(paramEnablePrefetch)
ctx.Runtime.AmplifyIO = scenario.GetUInt64(paramAmplifyIO)
ctx.Runtime.ChunkDedupDb = scenario.GetString(paramChunkDedupDb)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an unnecessary merge commit.

n.testMakeLayers(*ctx, t)
}
}
Expand Down
15 changes: 13 additions & 2 deletions smoke/tests/tool/nydusd.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type NydusdConfig struct {
AccessPattern bool
PrefetchFiles []string
AmplifyIO uint64
ChunkDedupDb string
// Hot Upgrade config.
Upgrade bool
SupervisorSockPath string
Expand Down Expand Up @@ -196,6 +197,9 @@ func newNydusd(conf NydusdConfig) (*Nydusd, error) {
if len(conf.BootstrapPath) > 0 {
args = append(args, "--bootstrap", conf.BootstrapPath)
}
if len(conf.ChunkDedupDb) > 0 {
args = append(args, "--dedup-db", conf.ChunkDedupDb)
}
if conf.Upgrade {
args = append(args, "--upgrade")
}
Expand Down Expand Up @@ -279,6 +283,7 @@ func NewNydusdWithContext(ctx Context) (*Nydusd, error) {
RafsMode: ctx.Runtime.RafsMode,
DigestValidate: false,
AmplifyIO: ctx.Runtime.AmplifyIO,
ChunkDedupDb: ctx.Runtime.ChunkDedupDb,
}

if err := makeConfig(NydusdConfigTpl, conf); err != nil {
Expand Down Expand Up @@ -516,8 +521,14 @@ func (nydusd *Nydusd) GetFilesMetrics(id string) (map[string]FileMetrics, error)
return info, nil
}

func (nydusd *Nydusd) GetBackendMetrics(id string) (*BackendMetrics, error) {
resp, err := nydusd.client.Get(fmt.Sprintf("http://unix/api/v1/metrics/backend?id=%s", id))
func (nydusd *Nydusd) GetBackendMetrics(id ...string) (*BackendMetrics, error) {
requestURL := "http://unix/api/v1/metrics/backend"
if len(id) == 1 {
requestURL = fmt.Sprintf("http://unix/api/v1/metrics/backend?id=%s", id[0])
} else if len(id) > 1 {
return nil, errors.Errorf("Multiple id are not allowed")
}
resp, err := nydusd.client.Get(requestURL)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/nydus-image/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1985,7 +1985,7 @@ impl Command {
}
} else if let Some(dir) = matches.get_one::<String>("blob-dir") {
config = Arc::new(ConfigV2::new_localfs("", dir)?);
backend = BlobFactory::new_backend(config.backend.as_ref().unwrap(), blob_id)?;
backend = BlobFactory::new_backend(&config.backend.as_ref().unwrap(), blob_id)?;
} else {
return Err(anyhow!("invalid backend configuration"));
}
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.