mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Add Veeam storage class override (#19748)
Recent Veeam is very picky about storage class names. Add `_MINIO_VEEAM_FORCE_SC` env var. It will override the storage class returned by the storage backend if it is non-standard and we detect a Veeam client by checking the User Agent. Applies to HeadObject/GetObject/ListObject*
This commit is contained in:
@@ -22,8 +22,11 @@ import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/minio/minio/internal/logger"
|
||||
)
|
||||
|
||||
// From Veeam-SOSAPI_1.0_Document_v1.02d.pdf
|
||||
@@ -83,6 +86,11 @@ type apiEndpoints struct {
|
||||
STSEndpoint string `xml:"STSEndpoint"`
|
||||
}
|
||||
|
||||
// globalVeeamForceSC is set by the environment variable _MINIO_VEEAM_FORCE_SC
|
||||
// This will override the storage class returned by the storage backend if it is non-standard
|
||||
// and we detect a Veeam client by checking the User Agent.
|
||||
var globalVeeamForceSC = os.Getenv("_MINIO_VEEAM_FORCE_SC")
|
||||
|
||||
type systemInfo struct {
|
||||
XMLName xml.Name `xml:"SystemInfo" json:"-"`
|
||||
ProtocolVersion string `xml:"ProtocolVersion"`
|
||||
@@ -115,6 +123,7 @@ type capacityInfo struct {
|
||||
const (
|
||||
systemXMLObject = ".system-d26a9498-cb7c-4a87-a44a-8ae204f5ba6c/system.xml"
|
||||
capacityXMLObject = ".system-d26a9498-cb7c-4a87-a44a-8ae204f5ba6c/capacity.xml"
|
||||
veeamAgentSubstr = "1.0 Veeam/1.0 Backup"
|
||||
)
|
||||
|
||||
func isVeeamSOSAPIObject(object string) bool {
|
||||
@@ -126,6 +135,12 @@ func isVeeamSOSAPIObject(object string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
// isVeeamClient - returns true if the request is from Veeam client.
|
||||
func isVeeamClient(ctx context.Context) bool {
|
||||
ri := logger.GetReqInfo(ctx)
|
||||
return ri != nil && strings.Contains(ri.UserAgent, veeamAgentSubstr)
|
||||
}
|
||||
|
||||
func veeamSOSAPIHeadObject(ctx context.Context, bucket, object string, opts ObjectOptions) (ObjectInfo, error) {
|
||||
gr, err := veeamSOSAPIGetObject(ctx, bucket, object, nil, opts)
|
||||
if gr != nil {
|
||||
|
||||
Reference in New Issue
Block a user