S3 peers should be initialized properly (#5024)

Fixes #4991
This commit is contained in:
Harshavardhana
2017-10-08 20:23:42 -07:00
committed by GitHub
parent d8a11c8f4b
commit db6b6e9518
5 changed files with 71 additions and 14 deletions
+12 -11
View File
@@ -41,12 +41,13 @@ type s3Peers []s3Peer
// slice. The urls slice is assumed to be non-empty and free of nil
// values.
func makeS3Peers(endpoints EndpointList) (s3PeerList s3Peers) {
localAddr := GetLocalPeer(endpoints)
s3PeerList = append(s3PeerList, s3Peer{
globalMinioAddr,
localAddr,
&localBucketMetaState{ObjectAPI: newObjectLayerFn},
})
hostSet := set.CreateStringSet(globalMinioAddr)
hostSet := set.CreateStringSet(localAddr)
cred := serverConfig.GetCredential()
serviceEndpoint := path.Join(minioReservedBucketPath, s3Path)
for _, host := range GetRemotePeers(endpoints) {
@@ -56,17 +57,17 @@ func makeS3Peers(endpoints EndpointList) (s3PeerList s3Peers) {
hostSet.Add(host)
s3PeerList = append(s3PeerList, s3Peer{
addr: host,
bmsClient: &remoteBucketMetaState{newAuthRPCClient(authConfig{
accessKey: cred.AccessKey,
secretKey: cred.SecretKey,
serverAddr: host,
serviceEndpoint: serviceEndpoint,
secureConn: globalIsSSL,
serviceName: "S3",
})},
bmsClient: &remoteBucketMetaState{
newAuthRPCClient(authConfig{
accessKey: cred.AccessKey,
secretKey: cred.SecretKey,
serverAddr: host,
serviceEndpoint: serviceEndpoint,
secureConn: globalIsSSL,
serviceName: "S3",
})},
})
}
return s3PeerList
}