From 42633748db374c3246070683da3f8fbefc54ff16 Mon Sep 17 00:00:00 2001 From: Nitish Tiwari Date: Fri, 12 Jan 2018 07:52:52 +0530 Subject: [PATCH] Update madmin package to return storage class parity (#5387) After the addition of Storage Class support, readQuorum and writeQuorum are decided on a per object basis, instead of deployment wide static quorums. This PR updates madmin api to remove readQuorum/writeQuorum and add Standard storage class and reduced redundancy storage class parity as return values. Since these parity values are used to decide the quorum for each object. Fixes #5378 --- cmd/object-api-datatypes.go | 4 ++-- cmd/server-startup-msg.go | 4 ++-- cmd/server-startup-msg_test.go | 28 ++++++++++++++-------------- cmd/xl-v1.go | 4 ++-- pkg/madmin/API.md | 4 ++-- pkg/madmin/README.md | 2 +- pkg/madmin/info-commands.go | 8 ++++---- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/cmd/object-api-datatypes.go b/cmd/object-api-datatypes.go index 1f6e9f957..ce64cb2f5 100644 --- a/cmd/object-api-datatypes.go +++ b/cmd/object-api-datatypes.go @@ -45,8 +45,8 @@ type StorageInfo struct { // Following fields are only meaningful if BackendType is Erasure. OnlineDisks int // Online disks during server startup. OfflineDisks int // Offline disks during server startup. - standardSCParity int // Parity disks for currently configured Standard storage class. - rrSCParity int // Parity disks for currently configured Reduced Redundancy storage class. + StandardSCParity int // Parity disks for currently configured Standard storage class. + RRSCParity int // Parity disks for currently configured Reduced Redundancy storage class. } } diff --git a/cmd/server-startup-msg.go b/cmd/server-startup-msg.go index 3e5e0c309..326867f9c 100644 --- a/cmd/server-startup-msg.go +++ b/cmd/server-startup-msg.go @@ -197,7 +197,7 @@ func printStorageClassInfoMsg(storageInfo StorageInfo) { func getStandardStorageClassInfoMsg(storageInfo StorageInfo) string { var msg string - if maxDiskFailures := storageInfo.Backend.standardSCParity - storageInfo.Backend.OfflineDisks; maxDiskFailures >= 0 { + if maxDiskFailures := storageInfo.Backend.StandardSCParity - storageInfo.Backend.OfflineDisks; maxDiskFailures >= 0 { msg += fmt.Sprintf("Objects with "+standardStorageClass+" class can withstand [%d] drive failure(s).\n", maxDiskFailures) } return msg @@ -205,7 +205,7 @@ func getStandardStorageClassInfoMsg(storageInfo StorageInfo) string { func getRRSStorageClassInfoMsg(storageInfo StorageInfo) string { var msg string - if maxDiskFailures := storageInfo.Backend.rrSCParity - storageInfo.Backend.OfflineDisks; maxDiskFailures >= 0 { + if maxDiskFailures := storageInfo.Backend.RRSCParity - storageInfo.Backend.OfflineDisks; maxDiskFailures >= 0 { msg += fmt.Sprintf("Objects with "+reducedRedundancyStorageClass+" class can withstand [%d] drive failure(s).\n", maxDiskFailures) } return msg diff --git a/cmd/server-startup-msg_test.go b/cmd/server-startup-msg_test.go index 3e4650baa..bfd89baaa 100644 --- a/cmd/server-startup-msg_test.go +++ b/cmd/server-startup-msg_test.go @@ -38,8 +38,8 @@ func TestStorageInfoMsg(t *testing.T) { Type BackendType OnlineDisks int OfflineDisks int - standardSCParity int - rrSCParity int + StandardSCParity int + RRSCParity int }{Erasure, 7, 1, 4, 5}, } @@ -169,8 +169,8 @@ func TestGetStandardStorageClassInfoMsg(t *testing.T) { Type BackendType OnlineDisks int OfflineDisks int - standardSCParity int - rrSCParity int + StandardSCParity int + RRSCParity int }{Erasure, 15, 1, 5, 3}, }, "Objects with " + standardStorageClass + " class can withstand [4] drive failure(s).\n"}, {"2", StorageInfo{ @@ -180,8 +180,8 @@ func TestGetStandardStorageClassInfoMsg(t *testing.T) { Type BackendType OnlineDisks int OfflineDisks int - standardSCParity int - rrSCParity int + StandardSCParity int + RRSCParity int }{Erasure, 10, 0, 5, 3}, }, "Objects with " + standardStorageClass + " class can withstand [5] drive failure(s).\n"}, {"3", StorageInfo{ @@ -191,8 +191,8 @@ func TestGetStandardStorageClassInfoMsg(t *testing.T) { Type BackendType OnlineDisks int OfflineDisks int - standardSCParity int - rrSCParity int + StandardSCParity int + RRSCParity int }{Erasure, 12, 3, 6, 2}, }, "Objects with " + standardStorageClass + " class can withstand [3] drive failure(s).\n"}, } @@ -216,8 +216,8 @@ func TestGetRRSStorageClassInfoMsg(t *testing.T) { Type BackendType OnlineDisks int OfflineDisks int - standardSCParity int - rrSCParity int + StandardSCParity int + RRSCParity int }{Erasure, 15, 1, 5, 3}, }, "Objects with " + reducedRedundancyStorageClass + " class can withstand [2] drive failure(s).\n"}, {"2", StorageInfo{ @@ -227,8 +227,8 @@ func TestGetRRSStorageClassInfoMsg(t *testing.T) { Type BackendType OnlineDisks int OfflineDisks int - standardSCParity int - rrSCParity int + StandardSCParity int + RRSCParity int }{Erasure, 16, 0, 5, 3}, }, "Objects with " + reducedRedundancyStorageClass + " class can withstand [3] drive failure(s).\n"}, {"3", StorageInfo{ @@ -238,8 +238,8 @@ func TestGetRRSStorageClassInfoMsg(t *testing.T) { Type BackendType OnlineDisks int OfflineDisks int - standardSCParity int - rrSCParity int + StandardSCParity int + RRSCParity int }{Erasure, 12, 3, 6, 5}, }, "Objects with " + reducedRedundancyStorageClass + " class can withstand [2] drive failure(s).\n"}, } diff --git a/cmd/xl-v1.go b/cmd/xl-v1.go index 5b7ae1a64..6d9a15e4c 100644 --- a/cmd/xl-v1.go +++ b/cmd/xl-v1.go @@ -247,10 +247,10 @@ func getStorageInfo(disks []StorageAPI) StorageInfo { storageInfo.Backend.OfflineDisks = offlineDisks _, scParity := getRedundancyCount(standardStorageClass, len(disks)) - storageInfo.Backend.standardSCParity = scParity + storageInfo.Backend.StandardSCParity = scParity _, rrSCparity := getRedundancyCount(reducedRedundancyStorageClass, len(disks)) - storageInfo.Backend.rrSCParity = rrSCparity + storageInfo.Backend.RRSCParity = rrSCparity return storageInfo } diff --git a/pkg/madmin/API.md b/pkg/madmin/API.md index e425761b8..ec65e5b3f 100644 --- a/pkg/madmin/API.md +++ b/pkg/madmin/API.md @@ -85,8 +85,8 @@ Fetch service status, replies disk space used, backend type and total disks offl |`backend.Type` | _BackendType_ | Type of backend used by the server currently only FS or Erasure. | |`backend.OnlineDisks`| _int_ | Total number of disks online (only applies to Erasure backend), is empty for FS. | |`backend.OfflineDisks` | _int_ | Total number of disks offline (only applies to Erasure backend), is empty for FS. | -|`backend.ReadQuorum` | _int_ | Current total read quorum threshold before reads will be unavailable, is empty for FS. | -|`backend.WriteQuorum` | _int_ | Current total write quorum threshold before writes will be unavailable, is empty for FS. | +|`backend.StandardSCParity` | _int_ | Parity disks set for standard storage class, is empty for FS. | +|`backend.RRSCParity` | _int_ | Parity disks set for reduced redundancy storage class, is empty for FS. | __Example__ diff --git a/pkg/madmin/README.md b/pkg/madmin/README.md index e2d16f1f8..6519d3e91 100644 --- a/pkg/madmin/README.md +++ b/pkg/madmin/README.md @@ -96,7 +96,7 @@ func main() { ```sh go run service-status.go -2016/12/20 16:46:01 madmin.ServiceStatusMetadata{Total:177038229504, Free:120365559808, Backend:struct { Type madmin.BackendType; OnlineDisks int; OfflineDisks int; ReadQuorum int; WriteQuorum int }{Type:1, OnlineDisks:0, OfflineDisks:0, ReadQuorum:0, WriteQuorum:0}} +2016/12/20 16:46:01 madmin.ServiceStatusMetadata{Total:177038229504, Free:120365559808, Backend:struct { Type madmin.BackendType; OnlineDisks int; OfflineDisks int; ReadQuorum int; WriteQuorum int }{Type:1, OnlineDisks:0, OfflineDisks:0, StandardSCParity:0, RRSCParity:0}} ``` diff --git a/pkg/madmin/info-commands.go b/pkg/madmin/info-commands.go index db9ffe5d0..60f46cfb2 100644 --- a/pkg/madmin/info-commands.go +++ b/pkg/madmin/info-commands.go @@ -51,10 +51,10 @@ type StorageInfo struct { Type BackendType // Following fields are only meaningful if BackendType is Erasure. - OnlineDisks int // Online disks during server startup. - OfflineDisks int // Offline disks during server startup. - ReadQuorum int // Minimum disks required for successful read operations. - WriteQuorum int // Minimum disks required for successful write operations. + OnlineDisks int // Online disks during server startup. + OfflineDisks int // Offline disks during server startup. + StandardSCParity int // Parity disks for currently configured Standard storage class. + RRSCParity int // Parity disks for currently configured Reduced Redundancy storage class. } }