mirror of
https://github.com/minio/minio.git
synced 2025-07-26 00:40:08 -04:00
control: Fix controller CLI handling with distributed server object layer.
Object layer initialization is done lazily fix it.
This commit is contained in:
parent
8797952409
commit
bb0466f4ce
@ -34,7 +34,7 @@ type HealListReply struct {
|
|||||||
|
|
||||||
// ListObjects - list all objects that needs healing.
|
// ListObjects - list all objects that needs healing.
|
||||||
func (c *controllerAPIHandlers) ListObjectsHeal(arg *HealListArgs, reply *HealListReply) error {
|
func (c *controllerAPIHandlers) ListObjectsHeal(arg *HealListArgs, reply *HealListReply) error {
|
||||||
objAPI := c.ObjectAPI
|
objAPI := c.ObjectAPI()
|
||||||
if objAPI == nil {
|
if objAPI == nil {
|
||||||
return errInvalidArgument
|
return errInvalidArgument
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ type HealObjectReply struct{}
|
|||||||
|
|
||||||
// HealObject - heal the object.
|
// HealObject - heal the object.
|
||||||
func (c *controllerAPIHandlers) HealObject(arg *HealObjectArgs, reply *HealObjectReply) error {
|
func (c *controllerAPIHandlers) HealObject(arg *HealObjectArgs, reply *HealObjectReply) error {
|
||||||
objAPI := c.ObjectAPI
|
objAPI := c.ObjectAPI()
|
||||||
if objAPI == nil {
|
if objAPI == nil {
|
||||||
return errInvalidArgument
|
return errInvalidArgument
|
||||||
}
|
}
|
||||||
|
@ -38,5 +38,5 @@ func registerControlRPCRouter(mux *router.Router, ctrlHandlers *controllerAPIHan
|
|||||||
|
|
||||||
// Handler for object healing.
|
// Handler for object healing.
|
||||||
type controllerAPIHandlers struct {
|
type controllerAPIHandlers struct {
|
||||||
ObjectAPI ObjectLayer
|
ObjectAPI func() ObjectLayer
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/rpc"
|
"net/rpc"
|
@ -106,16 +106,23 @@ func configureServerHandler(srvCmdConfig serverCmdConfig) http.Handler {
|
|||||||
ObjectAPI: newObjectLayerFn,
|
ObjectAPI: newObjectLayerFn,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize Controller.
|
||||||
|
ctrlHandlers := &controllerAPIHandlers{
|
||||||
|
ObjectAPI: newObjectLayerFn,
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize router.
|
// Initialize router.
|
||||||
mux := router.NewRouter()
|
mux := router.NewRouter()
|
||||||
|
|
||||||
// Register all routers.
|
// Register all routers.
|
||||||
registerStorageRPCRouters(mux, storageRPCs)
|
registerStorageRPCRouters(mux, storageRPCs)
|
||||||
|
|
||||||
|
// Initialize distributed NS lock.
|
||||||
initDistributedNSLock(mux, srvCmdConfig)
|
initDistributedNSLock(mux, srvCmdConfig)
|
||||||
|
|
||||||
// FIXME: till net/rpc auth is brought in "minio control" can be enabled only though
|
// FIXME: till net/rpc auth is brought in "minio control" can be enabled only though
|
||||||
// this env variable.
|
// this env variable.
|
||||||
if os.Getenv("MINIO_CONTROL") != "" {
|
if !strings.EqualFold(os.Getenv("MINIO_CONTROL"), "off") {
|
||||||
registerControlRPCRouter(mux, ctrlHandlers)
|
registerControlRPCRouter(mux, ctrlHandlers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@ -88,7 +88,7 @@ func loginRPCClient(rpcClient *RPCClient) (tokenStr string, err error) {
|
|||||||
}, &reply); err != nil {
|
}, &reply); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if reply.ServerVersion != minioVersion {
|
if reply.ServerVersion != Version {
|
||||||
return "", errors.New("Server version mismatch")
|
return "", errors.New("Server version mismatch")
|
||||||
}
|
}
|
||||||
// Reply back server provided token.
|
// Reply back server provided token.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
// RPCLoginArgs - login username and password for RPC.
|
// RPCLoginArgs - login username and password for RPC.
|
||||||
type RPCLoginArgs struct {
|
type RPCLoginArgs struct {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@ -73,7 +73,7 @@ func (s *storageServer) LoginHandler(args *RPCLoginArgs, reply *RPCLoginReply) e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
reply.Token = token
|
reply.Token = token
|
||||||
reply.ServerVersion = minioVersion
|
reply.ServerVersion = Version
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
@ -16,7 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
Loading…
x
Reference in New Issue
Block a user