XL/objects: Initialize format.json outside of erasure. (#1640)

Fixes #1636

New format now generates a UUID and includes it along with
the order of disks. So that UUID is the real order of disks
and on command line user is able to specify disks in any order.

This pre-dominantly solves our dilemma.
```
{
   "format" : "xl",
   "xl" : {
      "version" : "1",
      "disk": "00e4cf06-5bf5-4bb5-b885-4b2fff4a7959",
      "jbod" : [
         "00e4cf06-5bf5-4bb5-b885-4b2fff4a7959",
         ....
         "c47d2608-5067-4ed7-b1e4-fb81bdbb549f",
         "a543293e-99f1-4310-b540-1e450878e844",
         "18f97cbe-529a-456a-b6d4-0feacf64534d"
      ]
   },
   "version" : "1"
}
```
This commit is contained in:
Harshavardhana
2016-05-20 02:22:22 -07:00
committed by Anand Babu (AB) Periasamy
parent f5dfa895a5
commit e4240aa58f
10 changed files with 348 additions and 175 deletions

View File

@@ -25,14 +25,14 @@ import (
// newObjectLayer - initialize any object layer depending on the
// number of export paths.
func newObjectLayer(exportPaths ...string) (ObjectLayer, error) {
func newObjectLayer(exportPaths []string) (ObjectLayer, error) {
if len(exportPaths) == 1 {
exportPath := exportPaths[0]
// Initialize FS object layer.
return newFSObjects(exportPath)
}
// Initialize XL object layer.
objAPI, err := newXLObjects(exportPaths...)
objAPI, err := newXLObjects(exportPaths)
if err == errWriteQuorum {
return objAPI, errors.New("Disks are different with last minio server run.")
}
@@ -41,7 +41,7 @@ func newObjectLayer(exportPaths ...string) (ObjectLayer, error) {
// configureServer handler returns final handler for the http server.
func configureServerHandler(srvCmdConfig serverCmdConfig) http.Handler {
objAPI, err := newObjectLayer(srvCmdConfig.exportPaths...)
objAPI, err := newObjectLayer(srvCmdConfig.exportPaths)
fatalIf(err, "Unable to intialize object layer.")
// Initialize storage rpc server.