From fb39c7c26b60b0fb8883b7a27747ce9192fb47bf Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 15 Feb 2017 03:47:47 -0800 Subject: [PATCH] sRPC/client: Properly trim storageRPCPath for actual disk path. (#3749) Never print internal RPC endpoint paths. --- cmd/storage-rpc-client.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/storage-rpc-client.go b/cmd/storage-rpc-client.go index ebe62e35d..4020b6382 100644 --- a/cmd/storage-rpc-client.go +++ b/cmd/storage-rpc-client.go @@ -23,6 +23,7 @@ import ( "net/rpc" "net/url" "path" + "strings" "github.com/minio/minio/pkg/disk" ) @@ -132,20 +133,20 @@ func newStorageRPC(ep *url.URL) (StorageAPI, error) { // Stringer interface compatible representation of network device. func (n *networkStorage) String() string { - return n.rpcClient.ServerAddr() + ":" + n.rpcClient.ServiceEndpoint() + // Remove the storage RPC path prefix, internal paths are meaningless. + serviceEndpoint := strings.TrimPrefix(n.rpcClient.ServiceEndpoint(), storageRPCPath) + return n.rpcClient.ServerAddr() + ":" + serviceEndpoint } // Init - attempts a login to reconnect. func (n *networkStorage) Init() error { - err := n.rpcClient.Login() - return toStorageErr(err) + return toStorageErr(n.rpcClient.Login()) } // Closes the underlying RPC connection. -func (n *networkStorage) Close() (err error) { +func (n *networkStorage) Close() error { // Close the underlying connection. - err = n.rpcClient.Close() - return toStorageErr(err) + return toStorageErr(n.rpcClient.Close()) } // DiskInfo - fetch disk information for a remote disk.