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

Main rfs #2079

Merged
merged 5 commits into from
Oct 19, 2023
Merged
Changes from 4 commits
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
30 changes: 19 additions & 11 deletions pkg/flist/flist.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,25 +207,33 @@ func (f *flistModule) mountRO(url, storage string) (string, error) {
}

logPath := filepath.Join(f.log, hash) + ".log"
var args []string

args = append(args,
flistExt := filepath.Ext(url)
args := []string{
"--cache", f.cache,
"--meta", flistPath,
"--storage-url", storage,
"--daemon",
"--log", logPath,
// this is always read-only
"--ro",
mountpoint,
)
}

sublog.Info().Strs("args", args).Msg("starting 0-fs daemon")
cmd := f.commander.Command("g8ufs", args...)
var cmd *exec.Cmd
if flistExt == ".flist" {
sublog.Info().Strs("args", args).Msg("starting g8ufs daemon")
args = append(args,
"--storage-url", storage,
// this is always read-only
"--ro",
mountpoint,
)
cmd = f.commander.Command("g8ufs", args...)
} else if flistExt == ".fl" {
sublog.Info().Strs("args", args).Msg("starting rfs daemon")
args = append([]string{"mount"}, append(args, mountpoint)...)
cmd = f.commander.Command("rfs", args...)
}
Copy link
Member

Choose a reason for hiding this comment

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

can we add an else case here so we return an error if the url extension is unknown


var out []byte
if out, err = cmd.CombinedOutput(); err != nil {
sublog.Err(err).Str("out", string(out)).Msg("fail to start 0-fs daemon")
sublog.Err(err).Str("out", string(out)).Msg("failed to start 0-fs daemon")
return "", err
}

Expand Down
Loading