fix ConfigSys and NotificationSys initialization for NAS (#6920)

master
poornas 6 years ago committed by kannappanr
parent 8fcc787cba
commit f6980c4630
  1. 4
      cmd/bucket-notification-handlers.go
  2. 3
      cmd/dummy-object-layer_test.go
  3. 5
      cmd/fs-v1.go
  4. 5
      cmd/gateway-main.go
  5. 5
      cmd/gateway-unsupported.go
  6. 5
      cmd/gateway/nas/gateway-nas.go
  7. 1
      cmd/object-api-interface.go
  8. 5
      cmd/xl-sets.go
  9. 5
      cmd/xl-v1-bucket.go

@ -177,6 +177,10 @@ func (api objectAPIHandlers) ListenBucketNotificationHandler(w http.ResponseWrit
return return
} }
if !objAPI.IsListenBucketSupported() {
writeErrorResponse(w, ErrNotImplemented, r.URL, guessIsBrowserReq(r))
return
}
vars := mux.Vars(r) vars := mux.Vars(r)
bucketName := vars["bucket"] bucketName := vars["bucket"]

@ -154,6 +154,9 @@ func (api *DummyObjectLayer) DeleteBucketPolicy(context.Context, string) (err er
func (api *DummyObjectLayer) IsNotificationSupported() (b bool) { func (api *DummyObjectLayer) IsNotificationSupported() (b bool) {
return return
} }
func (api *DummyObjectLayer) IsListenBucketSupported() (b bool) {
return
}
func (api *DummyObjectLayer) IsEncryptionSupported() (b bool) { func (api *DummyObjectLayer) IsEncryptionSupported() (b bool) {
return return

@ -1306,6 +1306,11 @@ func (fs *FSObjects) IsNotificationSupported() bool {
return true return true
} }
// IsListenBucketSupported returns whether listen bucket notification is applicable for this layer.
func (fs *FSObjects) IsListenBucketSupported() bool {
return true
}
// IsEncryptionSupported returns whether server side encryption is applicable for this layer. // IsEncryptionSupported returns whether server side encryption is applicable for this layer.
func (fs *FSObjects) IsEncryptionSupported() bool { func (fs *FSObjects) IsEncryptionSupported() bool {
return true return true

@ -230,7 +230,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Create a new config system. // Create a new config system.
globalConfigSys = NewConfigSys() globalConfigSys = NewConfigSys()
if globalEtcdClient != nil { if globalEtcdClient != nil && gatewayName == "nas" {
// Initialize server config. // Initialize server config.
_ = globalConfigSys.Init(newObject) _ = globalConfigSys.Init(newObject)
} else { } else {
@ -281,10 +281,9 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Create new notification system. // Create new notification system.
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints) globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints)
if globalEtcdClient != nil { if globalEtcdClient != nil && newObject.IsNotificationSupported() {
_ = globalNotificationSys.Init(newObject) _ = globalNotificationSys.Init(newObject)
} }
// Once endpoints are finalized, initialize the new object api. // Once endpoints are finalized, initialize the new object api.
globalObjLayerMutex.Lock() globalObjLayerMutex.Lock()
globalObjectAPI = newObject globalObjectAPI = newObject

@ -132,6 +132,11 @@ func (a GatewayUnsupported) IsNotificationSupported() bool {
return false return false
} }
// IsListenBucketSupported returns whether listen bucket notification is applicable for this layer.
func (a GatewayUnsupported) IsListenBucketSupported() bool {
return false
}
// IsEncryptionSupported returns whether server side encryption is applicable for this layer. // IsEncryptionSupported returns whether server side encryption is applicable for this layer.
func (a GatewayUnsupported) IsEncryptionSupported() bool { func (a GatewayUnsupported) IsEncryptionSupported() bool {
return false return false

@ -116,6 +116,11 @@ func (g *NAS) Production() bool {
return true return true
} }
// IsListenBucketSupported returns whether listen bucket notification is applicable for this gateway.
func (g *NAS) IsListenBucketSupported() bool {
return false
}
// nasObjects implements gateway for Minio and S3 compatible object storage servers. // nasObjects implements gateway for Minio and S3 compatible object storage servers.
type nasObjects struct { type nasObjects struct {
minio.ObjectLayer minio.ObjectLayer

@ -94,6 +94,7 @@ type ObjectLayer interface {
// Supported operations check // Supported operations check
IsNotificationSupported() bool IsNotificationSupported() bool
IsListenBucketSupported() bool
IsEncryptionSupported() bool IsEncryptionSupported() bool
// Compression support check. // Compression support check.

@ -516,6 +516,11 @@ func (s *xlSets) IsNotificationSupported() bool {
return s.getHashedSet("").IsNotificationSupported() return s.getHashedSet("").IsNotificationSupported()
} }
// IsListenBucketSupported returns whether listen bucket notification is applicable for this layer.
func (s *xlSets) IsListenBucketSupported() bool {
return true
}
// IsEncryptionSupported returns whether server side encryption is applicable for this layer. // IsEncryptionSupported returns whether server side encryption is applicable for this layer.
func (s *xlSets) IsEncryptionSupported() bool { func (s *xlSets) IsEncryptionSupported() bool {
return s.getHashedSet("").IsEncryptionSupported() return s.getHashedSet("").IsEncryptionSupported()

@ -294,6 +294,11 @@ func (xl xlObjects) IsNotificationSupported() bool {
return true return true
} }
// IsListenBucketSupported returns whether listen bucket notification is applicable for this layer.
func (xl xlObjects) IsListenBucketSupported() bool {
return true
}
// IsEncryptionSupported returns whether server side encryption is applicable for this layer. // IsEncryptionSupported returns whether server side encryption is applicable for this layer.
func (xl xlObjects) IsEncryptionSupported() bool { func (xl xlObjects) IsEncryptionSupported() bool {
return true return true

Loading…
Cancel
Save