Assume standard storage class if not set in metadata (#5370)

If STANDARD storage class is set before starting up Minio server, 
but x-amz-storage-class metadata field is not set in a PutObject 
request, Minio server defaults to N/2 data and N/2 parity disks.

This PR changes the behaviour to use data and parity disks set in
STANDARD storage class, even if x-amz-storage-class metadata 
field is not present in PutObject requests.
This commit is contained in:
Nitish Tiwari
2018-01-11 14:58:12 +05:30
committed by GitHub
parent f413224b24
commit 1b721d76b1
4 changed files with 22 additions and 5 deletions

View File

@@ -173,6 +173,7 @@ func testGetRedundancyCount(obj ObjectLayer, instanceType string, dirs []string,
{3, "", xl.storageDisks, 8, 8},
{4, reducedRedundancyStorageClass, xl.storageDisks, 9, 7},
{5, standardStorageClass, xl.storageDisks, 10, 6},
{6, "", xl.storageDisks, 9, 7},
}
for _, tt := range tests {
// Set env var for test case 4
@@ -183,6 +184,10 @@ func testGetRedundancyCount(obj ObjectLayer, instanceType string, dirs []string,
if tt.name == 5 {
globalStandardStorageClass.Parity = 6
}
// Set env var for test case 6
if tt.name == 6 {
globalStandardStorageClass.Parity = 7
}
data, parity := getRedundancyCount(tt.sc, len(tt.disks))
if data != tt.expectedData {
t.Errorf("Test %d, Expected data disks %d, got %d", tt.name, tt.expectedData, data)