agent: fix etcd agent database ID switch

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-01-09 20:05:51 -08:00
parent 73df4ddd88
commit 8f3331d4ea
1 changed files with 39 additions and 3 deletions

View File

@ -48,9 +48,7 @@ func startEtcd(fs *flags, t *transporterServer) error {
var flags []string
switch t.req.DatabaseID {
case dbtesterpb.DatabaseID_etcd__tip,
dbtesterpb.DatabaseID_etcd__v3_2,
dbtesterpb.DatabaseID_etcd__v3_3:
case dbtesterpb.DatabaseID_etcd__tip:
flags = []string{
"--name", names[t.req.IPIndex],
"--data-dir", fs.etcdDataDir,
@ -69,6 +67,44 @@ func startEtcd(fs *flags, t *transporterServer) error {
"--initial-cluster-state", "new",
}
case dbtesterpb.DatabaseID_etcd__v3_2:
flags = []string{
"--name", names[t.req.IPIndex],
"--data-dir", fs.etcdDataDir,
"--quota-backend-bytes", fmt.Sprintf("%d", t.req.Flag_Etcd_V3_2.QuotaSizeBytes),
"--snapshot-count", fmt.Sprintf("%d", t.req.Flag_Etcd_V3_2.SnapshotCount),
"--listen-client-urls", clientURLs[t.req.IPIndex],
"--advertise-client-urls", clientURLs[t.req.IPIndex],
"--listen-peer-urls", peerURLs[t.req.IPIndex],
"--initial-advertise-peer-urls", peerURLs[t.req.IPIndex],
"--initial-cluster-token", "mytoken",
"--initial-cluster", strings.Join(members, ","),
"--initial-cluster-state", "new",
}
case dbtesterpb.DatabaseID_etcd__v3_3:
flags = []string{
"--name", names[t.req.IPIndex],
"--data-dir", fs.etcdDataDir,
"--quota-backend-bytes", fmt.Sprintf("%d", t.req.Flag_Etcd_V3_3.QuotaSizeBytes),
"--snapshot-count", fmt.Sprintf("%d", t.req.Flag_Etcd_V3_3.SnapshotCount),
"--listen-client-urls", clientURLs[t.req.IPIndex],
"--advertise-client-urls", clientURLs[t.req.IPIndex],
"--listen-peer-urls", peerURLs[t.req.IPIndex],
"--initial-advertise-peer-urls", peerURLs[t.req.IPIndex],
"--initial-cluster-token", "mytoken",
"--initial-cluster", strings.Join(members, ","),
"--initial-cluster-state", "new",
}
default:
return fmt.Errorf("database ID %q is not supported", t.req.DatabaseID)
}