-
Notifications
You must be signed in to change notification settings - Fork 72
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
Improve(hosts): use more meaningful name for host name #330
Conversation
It's a good job, but we need to backwards compatible。It means that |
Yes, I know that backward compatibility is a very important option, so I modified the get method in internal/configure/hosts/hc_get.go so that when using the GetName method, it first retrieves whether there is an attribute corresponding to the host keyword. Make a judgment and then decide to return the corresponding attribute. Through this operation, backward compatibility can be achieved. The hosts.yaml file with the attributes host and name can be deployed normally. My compatibility method may still not be correct. If so, Please guide me if there is anything that needs correction or a better way. Thank you very much. |
got. but you must ensue replace all getHost() with getName(). |
Ok,my mistake😭😭,my understanding of the entire system is still not deep enough. There may still be some places that need to be changed that I have not noticed. I will search the code again to determine if there are other places that need to be changed. I will modify the code as soon as possible and submit it. I hope to get it again. Tutor's help |
Hi @tiansuo114, thank you for your contribute :) |
I have tested the deployment of the curvefs/bs cluster, curvefs/bs client, console, curvefs/bs web monitoring, disk formatting, and other modules. Except for the cluster deployment module, all other modules run correctly when using the host/name keywords. However, I have a question regarding the cluster topology module. In the configuration file of this module, there are already host keywords that should be replaced and a name keyword that is automatically set according to rules if not explicitly declared. I'm unsure how to handle the host keyword in the cluster topology module. If no handling is required, I will finalize the code and push the final version after conducting another round of testing. |
cli/command/client/map.go
Outdated
$ curveadm map user:/volume --host machine1 --size=10GiB --create # Map volume which size is 10GiB and created by automatic | ||
$ curveadm map user:/volume --host machine1 --create --poolset ssd # Map volume created by automatic in poolset 'ssd' | ||
$ curveadm map user:/volume --host machine1 -c /path/to/client.yaml # Map volume with specified configure file` | ||
$ curveadm map user:/volume --name machine1 --create # Map volume which created by automatic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should keep the command option, i think the host
is more meaningful.
BTW: I think we should only convert the |
Okay, this is my understanding issue, I will modify the code as soon as possible |
@tiansuo114 Pls commit to develop branch again instead of tombstone |
Signed-off-by: noobcoder <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit message requires attention to the specification
return hc, nil | ||
} | ||
} | ||
return nil, errno.ERR_HOST_NOT_FOUND. | ||
F("host: %s", host) | ||
F("host: %s", name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the host printed here need to be replaced?
F("duplicate host: %s", hc.GetHost()) | ||
if _, ok := exist[hc.GetName()]; ok { | ||
return nil, errno.ERR_DUPLICATE_NAME. | ||
F("duplicate host: %s", hc.GetName()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
The contributor's suggested modification in the previous comment is as follows: I guess that maintaining this format, similar to "i-class item: j-item", can make it easier to identify the part that needs modification. Additionally, the contributor also raised the question of whether it should be changed to "host name" identifier because the "hostname" keyword is already used in the hosts module to represent the host's IP address. I guess that using this output format might cause confusion. If there is a mistake in my understanding, I will make corrections as soon as possible according to the correction opinions of community members. |
comm.REQUIRE_STRING, | ||
false, | ||
nil, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意换行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my mistake, i will fix it
internal/configure/hosts/hc_get.go
Outdated
@@ -67,7 +67,17 @@ func (hc *HostConfig) getBool(i *comm.Item) bool { | |||
return v.(bool) | |||
} | |||
|
|||
func (hc *HostConfig) getName() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数可以去掉,每个配置项都提供了一个默认值的钩子,你可以在上面做事情,可以参见 CONFIG_USER
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the guidance. Following your advice, I have re-implemented this functionality in the hc_item. If there are further areas that need modification, I would appreciate your guidance once again.
Signed-off-by: noobcoder <[email protected]>
This PR is about issue #260. I followed the advice of the instructor in the last PR and changed the host (keyword used to express the host identifier) in the configuration file required by curveadm hosts to name, and retained it. hostname keyword
Tests I did:
The tests I have done may still be incomplete. I hope to get the code review from the instructor and give further suggestions for modifications.
这个pr是有关于issue #260的,我遵循了上一次pr中导师提出的意见,将curveadm hosts 所需的配置文件中的host(用来表达主机标识符的关键字)更改为了name,并保留了hostname关键字
我所做的测试:
1.curveadm hosts命令下,该关键字可以正常发挥效果,hosts下的所有指令均能正常工作
2.curveadm format下,可以正常对磁盘进行格式化
3.可以正常进行整套部署curvefs的流程
我所做的测试可能仍不完备,希望能得到导师的代码审查,并给出更进一步的修改意见