Avoid ListBuckets() call instead rely on simple HTTP GET (#8475)

This is to avoid making calls to backend and requiring
gateways to allow permissions for ListBuckets() operation
just for Liveness checks, we can avoid this and make
our liveness checks to be more performant.
This commit is contained in:
Harshavardhana
2019-11-01 16:58:11 -07:00
committed by kannappanr
parent d28bcb4f84
commit 07a556a10b
10 changed files with 80 additions and 24 deletions

View File

@@ -185,7 +185,9 @@ func (g *Azure) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, erro
c.HTTPClient = &http.Client{Transport: minio.NewCustomHTTPTransport()}
return &azureObjects{
client: c.GetBlobService(),
endpoint: fmt.Sprintf("https://%s.blob.core.windows.net", creds.AccessKey),
httpClient: c.HTTPClient,
client: c.GetBlobService(),
}, nil
}
@@ -343,7 +345,9 @@ func azurePropertiesToS3Meta(meta storage.BlobMetadata, props storage.BlobProper
// azureObjects - Implements Object layer for Azure blob storage.
type azureObjects struct {
minio.GatewayUnsupported
client storage.BlobStorageClient // Azure sdk client
endpoint string
httpClient *http.Client
client storage.BlobStorageClient // Azure sdk client
}
// Convert azure errors to minio object layer errors.
@@ -447,6 +451,8 @@ func (a *azureObjects) Shutdown(ctx context.Context) error {
// StorageInfo - Not relevant to Azure backend.
func (a *azureObjects) StorageInfo(ctx context.Context) (si minio.StorageInfo) {
si.Backend.Type = minio.BackendGateway
si.Backend.GatewayOnline = minio.IsBackendOnline(ctx, a.httpClient, a.endpoint)
return si
}