1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 21:45:43 +01:00
Files
glusterd2/plugins/dht/validate.go
Aravinda VK 8de2a9ee49 Fix Option names in group profile and add db profile
- Group profile for transactional DB workload added
- Fixed the option names used in other group profiles
- Fixed the validation issues related to setting the options

glusterfs PR to support enable/disable of xlators
https://review.gluster.org/21813

Fixes: #1250
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-12-07 11:25:17 +05:30

33 lines
742 B
Go

package dht
import (
"fmt"
"strings"
"github.com/gluster/glusterd2/glusterd2/volume"
"github.com/gluster/glusterd2/glusterd2/xlator"
)
var names = [...]string{"distribute", "dht"}
func validateOptions(v *volume.Volinfo, key, value string) error {
if strings.Contains(key, "readdirplus-for-dir") {
if value == "on" {
if v, ok := v.Options["features/upcall.cache-invalidation"]; ok && v == "on" {
return nil
}
if v, ok := v.Options["upcall.cache-invalidation"]; ok && v == "on" {
return nil
}
return fmt.Errorf("enable \"features/upcall.cache-invalidation\" before enabling %s", key)
}
}
return nil
}
func init() {
for _, name := range names {
xlator.RegisterValidationFunc(name, validateOptions)
}
}