Merge pull request #46367 from bobveznat/master

Automatic merge from submit-queue (batch tested with PRs 46450, 46272, 46453, 46019, 46367)

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 message in, but require a -v in
order to actually log it.

**What this PR does / why we need it**: Moves a verbose log message to actually be verbose.

**Which issue this PR fixes** fixes #46364
Fixes #29059
This commit is contained in:
Kubernetes Submit Queue 2017-05-26 18:49:04 -07:00 committed by GitHub
commit ef1febf789
4 changed files with 22 additions and 11 deletions

View File

@ -235,14 +235,16 @@ func (rc *reconciler) reconcile() {
} else if !volMounted || cache.IsRemountRequiredError(err) { } else if !volMounted || cache.IsRemountRequiredError(err) {
// Volume is not mounted, or is already mounted, but requires remounting // Volume is not mounted, or is already mounted, but requires remounting
remountingLogStr := "" remountingLogStr := ""
if cache.IsRemountRequiredError(err) { isRemount := cache.IsRemountRequiredError(err)
if isRemount {
remountingLogStr = "Volume is already mounted to pod, but remount was requested." remountingLogStr = "Volume is already mounted to pod, but remount was requested."
} }
glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr)) glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr))
err := rc.operationExecutor.MountVolume( err := rc.operationExecutor.MountVolume(
rc.waitForAttachTimeout, rc.waitForAttachTimeout,
volumeToMount.VolumeToMount, volumeToMount.VolumeToMount,
rc.actualStateOfWorld) rc.actualStateOfWorld,
isRemount)
if err != nil && if err != nil &&
!nestedpendingoperations.IsAlreadyExists(err) && !nestedpendingoperations.IsAlreadyExists(err) &&
!exponentialbackoff.IsExponentialBackoff(err) { !exponentialbackoff.IsExponentialBackoff(err) {

View File

@ -89,7 +89,10 @@ type OperationExecutor interface {
// * Mount the volume to the pod specific path. // * Mount the volume to the pod specific path.
// * Update actual state of world to reflect volume is mounted to the pod // * Update actual state of world to reflect volume is mounted to the pod
// path. // 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 // UnmountVolume unmounts the volume from the pod specified in
// volumeToUnmount and updates the actual state of the world to reflect that. // volumeToUnmount and updates the actual state of the world to reflect that.
@ -652,9 +655,10 @@ func (oe *operationExecutor) VerifyVolumesAreAttachedPerNode(
func (oe *operationExecutor) MountVolume( func (oe *operationExecutor) MountVolume(
waitForAttachTimeout time.Duration, waitForAttachTimeout time.Duration,
volumeToMount VolumeToMount, volumeToMount VolumeToMount,
actualStateOfWorld ActualStateOfWorldMounterUpdater) error { actualStateOfWorld ActualStateOfWorldMounterUpdater,
isRemount bool) error {
mountFunc, err := oe.operationGenerator.GenerateMountVolumeFunc( mountFunc, err := oe.operationGenerator.GenerateMountVolumeFunc(
waitForAttachTimeout, volumeToMount, actualStateOfWorld) waitForAttachTimeout, volumeToMount, actualStateOfWorld, isRemount)
if err != nil { if err != nil {
return err return err
} }

View File

@ -60,7 +60,7 @@ func TestOperationExecutor_MountVolume_ConcurrentMountForNonAttachablePlugins(t
PluginIsAttachable: false, // this field determines whether the plugin is attachable PluginIsAttachable: false, // this field determines whether the plugin is attachable
ReportedInUse: true, ReportedInUse: true,
} }
oe.MountVolume(0 /* waitForAttachTimeOut */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */) oe.MountVolume(0 /* waitForAttachTimeOut */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */, false /* isRemount */)
} }
// Assert // Assert
@ -86,7 +86,7 @@ func TestOperationExecutor_MountVolume_ConcurrentMountForAttachablePlugins(t *te
PluginIsAttachable: true, // this field determines whether the plugin is attachable PluginIsAttachable: true, // this field determines whether the plugin is attachable
ReportedInUse: true, ReportedInUse: true,
} }
oe.MountVolume(0 /* waitForAttachTimeout */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */) oe.MountVolume(0 /* waitForAttachTimeout */, volumesToMount[i], nil /* actualStateOfWorldMounterUpdater */, false /* isRemount */)
} }
// Assert // 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 { return func() error {
startOperationAndBlock(fopg.ch, fopg.quit) startOperationAndBlock(fopg.ch, fopg.quit)
return nil return nil

View File

@ -70,7 +70,7 @@ func NewOperationGenerator(kubeClient clientset.Interface,
// OperationGenerator interface that extracts out the functions from operation_executor to make it dependency injectable // OperationGenerator interface that extracts out the functions from operation_executor to make it dependency injectable
type OperationGenerator interface { type OperationGenerator interface {
// Generates the MountVolume function needed to perform the mount of a volume plugin // 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 // Generates the UnmountVolume function needed to perform the unmount of a volume plugin
GenerateUnmountVolumeFunc(volumeToUnmount MountedVolume, actualStateOfWorld ActualStateOfWorldMounterUpdater) (func() error, error) GenerateUnmountVolumeFunc(volumeToUnmount MountedVolume, actualStateOfWorld ActualStateOfWorldMounterUpdater) (func() error, error)
@ -354,7 +354,8 @@ func (og *operationGenerator) GenerateDetachVolumeFunc(
func (og *operationGenerator) GenerateMountVolumeFunc( func (og *operationGenerator) GenerateMountVolumeFunc(
waitForAttachTimeout time.Duration, waitForAttachTimeout time.Duration,
volumeToMount VolumeToMount, volumeToMount VolumeToMount,
actualStateOfWorld ActualStateOfWorldMounterUpdater) (func() error, error) { actualStateOfWorld ActualStateOfWorldMounterUpdater,
isRemount bool) (func() error, error) {
// Get mounter plugin // Get mounter plugin
volumePlugin, err := volumePlugin, err :=
og.volumePluginMgr.FindPluginBySpec(volumeToMount.VolumeSpec) og.volumePluginMgr.FindPluginBySpec(volumeToMount.VolumeSpec)
@ -456,7 +457,11 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
return detailedErr 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 // Update actual state of world
markVolMountedErr := actualStateOfWorld.MarkVolumeAsMounted( markVolMountedErr := actualStateOfWorld.MarkVolumeAsMounted(