From aca05c922c0d84e4e7bf4093a60a57802e9b6b35 Mon Sep 17 00:00:00 2001 From: Bob Van Zant Date: Wed, 24 May 2017 10:25:34 -0700 Subject: [PATCH] Move MountVolume.SetUp succeeded to debug level This message is verbose and repeated over and over again in log files creating a lot of noise. Leave the messsage in, but require a -v in order to actually log it. Fixes #29059 --- pkg/kubelet/volumemanager/reconciler/reconciler.go | 6 ++++-- .../util/operationexecutor/operation_executor.go | 10 +++++++--- .../util/operationexecutor/operation_executor_test.go | 6 +++--- .../util/operationexecutor/operation_generator.go | 11 ++++++++--- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler.go b/pkg/kubelet/volumemanager/reconciler/reconciler.go index 0bbee6ef263..b2c2ea3fcdd 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler.go @@ -235,14 +235,16 @@ func (rc *reconciler) reconcile() { } else if !volMounted || cache.IsRemountRequiredError(err) { // Volume is not mounted, or is already mounted, but requires remounting remountingLogStr := "" - if cache.IsRemountRequiredError(err) { + isRemount := cache.IsRemountRequiredError(err) + if isRemount { remountingLogStr = "Volume is already mounted to pod, but remount was requested." } glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr)) err := rc.operationExecutor.MountVolume( rc.waitForAttachTimeout, volumeToMount.VolumeToMount, - rc.actualStateOfWorld) + rc.actualStateOfWorld, + isRemount) if err != nil && !nestedpendingoperations.IsAlreadyExists(err) && !exponentialbackoff.IsExponentialBackoff(err) { diff --git a/pkg/volume/util/operationexecutor/operation_executor.go b/pkg/volume/util/operationexecutor/operation_executor.go index 3225cacd44d..ca10b27714b 100644 --- a/pkg/volume/util/operationexecutor/operation_executor.go +++ b/pkg/volume/util/operationexecutor/operation_executor.go @@ -89,7 +89,10 @@ type OperationExecutor interface { // * Mount the volume to the pod specific path. // * Update actual state of world to reflect volume is mounted to the pod // path. - MountVolume(waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, actualStateOfWorld ActualStateOfWorldMounterUpdater) error + // The parameter "isRemount" is informational and used to adjust logging + // verbosity. An initial mount is more log-worthy than a remount, for + // example. + MountVolume(waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, actualStateOfWorld ActualStateOfWorldMounterUpdater, isRemount bool) error // UnmountVolume unmounts the volume from the pod specified in // volumeToUnmount and updates the actual state of the world to reflect that. @@ -648,9 +651,10 @@ func (oe *operationExecutor) VerifyVolumesAreAttachedPerNode( func (oe *operationExecutor) MountVolume( waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, - actualStateOfWorld ActualStateOfWorldMounterUpdater) error { + actualStateOfWorld ActualStateOfWorldMounterUpdater, + isRemount bool) error { mountFunc, err := oe.operationGenerator.GenerateMountVolumeFunc( - waitForAttachTimeout, volumeToMount, actualStateOfWorld) + waitForAttachTimeout, volumeToMount, actualStateOfWorld, isRemount) if err != nil { return err } diff --git a/pkg/volume/util/operationexecutor/operation_executor_test.go b/pkg/volume/util/operationexecutor/operation_executor_test.go index 87400c8766f..b312b29d451 100644 --- a/pkg/volume/util/operationexecutor/operation_executor_test.go +++ b/pkg/volume/util/operationexecutor/operation_executor_test.go @@ -60,7 +60,7 @@ func TestOperationExecutor_MountVolume_ConcurrentMountForNonAttachablePlugins(t PluginIsAttachable: false, // this field determines whether the plugin is attachable ReportedInUse: true, } - oe.MountVolume(0 /* waitForAttachTimeOut */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */) + oe.MountVolume(0 /* waitForAttachTimeOut */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */, false /* isRemount */) } // Assert @@ -86,7 +86,7 @@ func TestOperationExecutor_MountVolume_ConcurrentMountForAttachablePlugins(t *te PluginIsAttachable: true, // this field determines whether the plugin is attachable ReportedInUse: true, } - oe.MountVolume(0 /* waitForAttachTimeout */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */) + oe.MountVolume(0 /* waitForAttachTimeout */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */, false /* isRemount */) } // Assert @@ -239,7 +239,7 @@ func newFakeOperationGenerator(ch chan interface{}, quit chan interface{}) Opera } } -func (fopg *fakeOperationGenerator) GenerateMountVolumeFunc(waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, actualStateOfWorldMounterUpdater ActualStateOfWorldMounterUpdater) (func() error, error) { +func (fopg *fakeOperationGenerator) GenerateMountVolumeFunc(waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, actualStateOfWorldMounterUpdater ActualStateOfWorldMounterUpdater, isRemount bool) (func() error, error) { return func() error { startOperationAndBlock(fopg.ch, fopg.quit) return nil diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index f6ced832005..20059b527ac 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -70,7 +70,7 @@ func NewOperationGenerator(kubeClient clientset.Interface, // OperationGenerator interface that extracts out the functions from operation_executor to make it dependency injectable type OperationGenerator interface { // Generates the MountVolume function needed to perform the mount of a volume plugin - GenerateMountVolumeFunc(waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, actualStateOfWorldMounterUpdater ActualStateOfWorldMounterUpdater) (func() error, error) + GenerateMountVolumeFunc(waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, actualStateOfWorldMounterUpdater ActualStateOfWorldMounterUpdater, isRemount bool) (func() error, error) // Generates the UnmountVolume function needed to perform the unmount of a volume plugin GenerateUnmountVolumeFunc(volumeToUnmount MountedVolume, actualStateOfWorld ActualStateOfWorldMounterUpdater) (func() error, error) @@ -354,7 +354,8 @@ func (og *operationGenerator) GenerateDetachVolumeFunc( func (og *operationGenerator) GenerateMountVolumeFunc( waitForAttachTimeout time.Duration, volumeToMount VolumeToMount, - actualStateOfWorld ActualStateOfWorldMounterUpdater) (func() error, error) { + actualStateOfWorld ActualStateOfWorldMounterUpdater, + isRemount bool) (func() error, error) { // Get mounter plugin volumePlugin, err := og.volumePluginMgr.FindPluginBySpec(volumeToMount.VolumeSpec) @@ -456,7 +457,11 @@ func (og *operationGenerator) GenerateMountVolumeFunc( return detailedErr } - glog.Infof(volumeToMount.GenerateMsgDetailed("MountVolume.SetUp succeeded", "")) + verbosity := glog.Level(1) + if isRemount { + verbosity = glog.Level(7) + } + glog.V(verbosity).Infof(volumeToMount.GenerateMsgDetailed("MountVolume.SetUp succeeded", "")) // Update actual state of world markVolMountedErr := actualStateOfWorld.MarkVolumeAsMounted(