Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

feature: add golbal dfget params to the dfdaemon config #771

Merged
merged 1 commit into from
Aug 5, 2019

Conversation

starnop
Copy link
Contributor

@starnop starnop commented Aug 1, 2019

Signed-off-by: Starnop [email protected]

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

fixes part of #687

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

TODO.

Ⅳ. Describe how to verify it

cat /etc/dragonfly/dfdaemon.yml
# node is the supernode address
# ip should be the ip address that the other nodes in the p2p network can access.
# port is the port that peer server will listen on
global_dfget_params: ["--node","192.168.33.21","--verbose","--ip","192.168.33.22","--port","15001","--alivetime","0s","--expiretime","5m0s"]
......

Ⅴ. Special notes for reviews

In my opition, I think it's not a good way to use CLI args to pass values to the dfget compared to the config file. So I have not added a flag for dfget params. @lowzj @yeya24 WDYT?

In this PR, I only add a globalDfgetParams through the dfdaemon config file firstly. And we can add a dfgetParam for every proxy later.

In addition, there is one more thing we need to pay attention to: how should we verify the correctness of the dfget params? Do you have any good ideas?

@codecov-io
Copy link

codecov-io commented Aug 1, 2019

Codecov Report

Merging #771 into master will decrease coverage by 0.19%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #771     +/-   ##
=========================================
- Coverage   39.41%   39.21%   -0.2%     
=========================================
  Files         108      108             
  Lines        6310     6309      -1     
=========================================
- Hits         2487     2474     -13     
- Misses       3618     3630     +12     
  Partials      205      205
Impacted Files Coverage Δ
cmd/dfdaemon/app/root.go 63.63% <ø> (-1.37%) ⬇️
dfdaemon/config/config.go 90.24% <0%> (-9.76%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68ba7b4...1599fa2. Read the comment docs.

Verbose bool `yaml:"verbose" json:"verbose"`

MaxProcs int `yaml:"maxprocs" json:"maxprocs"`

// dfget config
GlobalDfgetParams []string `yaml:"global_dfget_params" json:"global_dfget_params"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this should be a slice. Can we define a struct for this such as DfgetParams? Then we can reuse it in proxy. And we can do some validation using this struct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If that, we have to redefine a struct just like dfget config.

Copy link
Collaborator

Choose a reason for hiding this comment

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

make sense

Copy link
Member

Choose a reason for hiding this comment

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

just use dfgetflags? And it should be assigned a default value.

@pouchrobot pouchrobot added size/M and removed size/L labels Aug 1, 2019
@starnop starnop changed the title [WIP]feature: add golbal dfget params to the dfdaemon config feature: add golbal dfget params to the dfdaemon config Aug 1, 2019
Copy link
Collaborator

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Can you provide an example configuration? Since we remove the flags, I think it is better to add a configuration with some default global dfget params.

@starnop
Copy link
Contributor Author

starnop commented Aug 2, 2019

Can you provide an example configuration? Since we remove the flags, I think it is better to add a configuration with some default global dfget params.

I have added the corresponding comment in the code. In addition, we need to add a docs dir which including all docs about configuration files. And we should make it ASAP.

@starnop
Copy link
Contributor Author

starnop commented Aug 2, 2019

@lowzj @yeya24 PTAL. THX

Copy link
Collaborator

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

LGTM

Verbose bool `yaml:"verbose" json:"verbose"`

MaxProcs int `yaml:"maxprocs" json:"maxprocs"`

// dfget config
GlobalDfgetParams []string `yaml:"global_dfget_params" json:"global_dfget_params"`
Copy link
Member

Choose a reason for hiding this comment

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

just use dfgetflags? And it should be assigned a default value.


if dfGetter.config.Verbose {
args = append(args, "--verbose")
for _, param := range dfGetter.config.GlobalDfgetParams {
Copy link
Member

Choose a reason for hiding this comment

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

use args = append(args, dfGetter.config.GlobalDfgetParams...)

args = append(args, "--notbs")
}

if dfGetter.config.Verbose {
Copy link
Member

@lowzj lowzj Aug 2, 2019

Choose a reason for hiding this comment

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

This should not be deleted if the --verbose flag of dfdaemon has been set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. PTAL again. THX

@starnop starnop force-pushed the bug-ip branch 3 times, most recently from 4d0eb89 to a84c2a7 Compare August 5, 2019 02:08
Copy link
Member

@lowzj lowzj left a comment

Choose a reason for hiding this comment

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

LGTM

@lowzj lowzj merged commit 24aa469 into dragonflyoss:master Aug 5, 2019
starnop pushed a commit to starnop/Dragonfly that referenced this pull request Nov 27, 2019
feature: add golbal dfget params to the dfdaemon config
inoc603 pushed a commit to inoc603/Dragonfly that referenced this pull request Dec 23, 2019
feature: add golbal dfget params to the dfdaemon config
sungjunyoung pushed a commit to sungjunyoung/Dragonfly that referenced this pull request May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants