Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

allow user to choose ETCD ports for vFile usage #1988

Merged
merged 4 commits into from
Nov 26, 2017

Conversation

lipingxue
Copy link
Contributor

@lipingxue lipingxue commented Nov 14, 2017

Fixed #1970

With this change, user can specify etcd cluster port number other than default value (default etcdClientPort is 2379 and etcdClientPort is 2380) used by vFile.
User need to specify those port numbers through environment variable "VFILE_ETCD_CLIENT_PORT" and "VFILE_ETCD_PEER_PORT", see the following example:

docker plugin install --grant-all-permissions --alias vfile lipingxue/vfile:vfile-etcd_port VFILE_TIMEOUT_IN_SECOND=300 VFILE_ETCD_CLIENT_PORT=4001 VFILE_ETCD_PEER_PORT=4002

After install the vFile plugin, test basic volume create/mount/unmount, works as expected.

@@ -893,6 +916,7 @@ func (e *EtcdKVS) createEtcdClient() *etcdClient.Client {
func addrToEtcdClient(addr string) (*etcdClient.Client, error) {
// input address are RemoteManagers from docker info or ManagerStatus.Addr from docker inspect
// in the format of [host]:[docker manager port]
etcdClientPort, _ := getEtcdPorts()
Copy link
Contributor

@luomiao luomiao Nov 20, 2017

Choose a reason for hiding this comment

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

This addrToEtcdClient function is called inside createEtcdClient function and will be called for almost every ETCD operations. So calling getEtcdPorts inside this function is not efficient (means everytime we have to read ENVs although they are never changed across the same installation since they are installation flags).
I suggest that we should call getEtcdPorts at the very beginning and then store the information inside the local EtcdKVS struct. And later in addrToEtcdClient we just need to grab this information locally, instead of reading the ENV flags again and again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luomiao I have addressed your comments, please take a look. Thanks!

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.

3 participants