mirror of https://github.com/k3s-io/k3s
Add `log-level` mount option support for glusterfs plugin
The glusterfs plugin/driver set log-level to ERROR by default while mounting glusterfs shares. However at times, its required to supply other log-level options like INFO, TRACE..etc. This patch enables the support to provide other log-level values from storageclass. Additional Ref# https://docs.gluster.org/en/v3/Administrator%20Guide/Setting%20Up%20Clients/ Signed-off-by: Humble Chirammal <hchiramm@redhat.com>pull/58/head
parent
c179a9c9df
commit
fdcd58a794
|
@ -290,6 +290,7 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
|
||||||
var errs error
|
var errs error
|
||||||
options := []string{}
|
options := []string{}
|
||||||
hasLogFile := false
|
hasLogFile := false
|
||||||
|
hasLogLevel := false
|
||||||
log := ""
|
log := ""
|
||||||
|
|
||||||
if b.readOnly {
|
if b.readOnly {
|
||||||
|
@ -297,13 +298,19 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check logfile has been provided by user, if provided, use that as the log file.
|
// Check for log-file,log-level options existence in user supplied mount options, if provided, use those.
|
||||||
for _, userOpt := range b.mountOptions {
|
for _, userOpt := range b.mountOptions {
|
||||||
if dstrings.HasPrefix(userOpt, "log-file") {
|
|
||||||
|
switch {
|
||||||
|
case dstrings.HasPrefix(userOpt, "log-file"):
|
||||||
glog.V(4).Infof("log-file mount option has provided")
|
glog.V(4).Infof("log-file mount option has provided")
|
||||||
hasLogFile = true
|
hasLogFile = true
|
||||||
break
|
|
||||||
|
case dstrings.HasPrefix(userOpt, "log-level"):
|
||||||
|
glog.V(4).Infof("log-level mount option has provided")
|
||||||
|
hasLogLevel = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If logfile has not been provided, create driver specific log file.
|
// If logfile has not been provided, create driver specific log file.
|
||||||
|
@ -324,7 +331,9 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
options = append(options, "log-level=ERROR")
|
if !hasLogLevel {
|
||||||
|
options = append(options, "log-level=ERROR")
|
||||||
|
}
|
||||||
|
|
||||||
var addrlist []string
|
var addrlist []string
|
||||||
if b.hosts == nil {
|
if b.hosts == nil {
|
||||||
|
|
Loading…
Reference in New Issue