mirror of
https://github.com/minio/minio.git
synced 2025-12-02 22:20:43 -05:00
server: save and compare multiple disks are used (#1474)
When server is run with multiple disks which uses xl interface where order and count of disks are important, this patch saves such disks configuration and compares in next run if there is a mismatch. Fixes #1458
This commit is contained in:
22
routers.go
22
routers.go
@@ -17,7 +17,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
router "github.com/gorilla/mux"
|
||||
)
|
||||
@@ -36,6 +38,26 @@ func newObjectLayer(exportPaths ...string) (ObjectLayer, error) {
|
||||
|
||||
// configureServer handler returns final handler for the http server.
|
||||
func configureServerHandler(srvCmdConfig serverCmdConfig) http.Handler {
|
||||
// FIXME: currently we don't check single exportPath which uses FS layer.
|
||||
if len(srvCmdConfig.exportPaths) > 1 {
|
||||
if isFormatConfigFileExists() {
|
||||
format, err := getFormatXL()
|
||||
if err != nil {
|
||||
fatalIf(err, "Failed to read format.json", nil)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(format.Disks, srvCmdConfig.exportPaths) {
|
||||
err = fmt.Errorf("Number of export paths from command-line did not match the backend configuration. Backend is configured with [%s] exports.", format.Disks)
|
||||
fatalIf(err, "", nil)
|
||||
}
|
||||
} else {
|
||||
// First run: save disk configuration
|
||||
if err := saveFormatXL(xlFormat{Version: "1", Disks: srvCmdConfig.exportPaths}); err != nil {
|
||||
fatalIf(err, "Unable to save 'format.json'", nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
objAPI, err := newObjectLayer(srvCmdConfig.exportPaths...)
|
||||
fatalIf(err, "Initializing object layer failed.", nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user