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
Humble Chirammal 2018-10-03 10:16:41 +05:30
parent c179a9c9df
commit fdcd58a794
1 changed files with 13 additions and 4 deletions

View File

@ -290,6 +290,7 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
var errs error
options := []string{}
hasLogFile := false
hasLogLevel := false
log := ""
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 {
if dstrings.HasPrefix(userOpt, "log-file") {
switch {
case dstrings.HasPrefix(userOpt, "log-file"):
glog.V(4).Infof("log-file mount option has provided")
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.
@ -324,7 +331,9 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
}
if !hasLogLevel {
options = append(options, "log-level=ERROR")
}
var addrlist []string
if b.hosts == nil {