From e2600963920e46ad72c37d69e3f2a9576bdee85c Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Thu, 15 Feb 2018 16:33:17 +0100 Subject: [PATCH] Rework volume manager log levels - all normal logs to go to level 4 - too frequent / duplicate logs go to level 5 (e.g. when something else logged similar message not too far away). --- .../populator/desired_state_of_world_populator.go | 12 ++++++------ pkg/kubelet/volumemanager/reconciler/reconciler.go | 12 ++++++------ .../util/operationexecutor/operation_executor.go | 4 ++-- .../util/operationexecutor/operation_generator.go | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go b/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go index 6f86e43c3d..db56cf1539 100644 --- a/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go +++ b/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go @@ -236,13 +236,13 @@ func (dswp *desiredStateOfWorldPopulator) findAndRemoveDeletedPods() { } if runningContainers { - glog.V(5).Infof( + glog.V(4).Infof( "Pod %q has been removed from pod manager. However, it still has one or more containers in the non-exited state. Therefore, it will not be removed from volume manager.", format.Pod(volumeToMount.Pod)) continue } - glog.V(5).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state", "")) + glog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Removing volume from desired state", "")) dswp.desiredStateOfWorld.DeletePodFromVolume( volumeToMount.PodName, volumeToMount.VolumeName) @@ -292,7 +292,7 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes(pod *v1.Pod) { allVolumesAdded = false } - glog.V(10).Infof( + glog.V(4).Infof( "Added volume %q (volSpec=%q) for pod %q to desired state.", podVolume.Name, volumeSpec.Name(), @@ -343,7 +343,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec( podVolume v1.Volume, podName string, podNamespace string, mountsMap map[string]bool, devicesMap map[string]bool) (*volume.Spec, string, error) { if pvcSource := podVolume.VolumeSource.PersistentVolumeClaim; pvcSource != nil { - glog.V(10).Infof( + glog.V(5).Infof( "Found PVC, ClaimName: %q/%q", podNamespace, pvcSource.ClaimName) @@ -359,7 +359,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec( err) } - glog.V(10).Infof( + glog.V(5).Infof( "Found bound PV for PVC (ClaimName %q/%q pvcUID %v): pvName=%q", podNamespace, pvcSource.ClaimName, @@ -377,7 +377,7 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec( err) } - glog.V(10).Infof( + glog.V(5).Infof( "Extracted volumeSpec (%v) from bound PV (pvName %q) and PVC (ClaimName %q/%q pvcUID %v)", volumeSpec.Name, pvName, diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler.go b/pkg/kubelet/volumemanager/reconciler/reconciler.go index 759e3bdb54..18d8f533d8 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler.go @@ -167,7 +167,7 @@ func (rc *reconciler) reconcile() { for _, mountedVolume := range rc.actualStateOfWorld.GetMountedVolumes() { if !rc.desiredStateOfWorld.PodExistsInVolume(mountedVolume.PodName, mountedVolume.VolumeName) { // Volume is mounted, unmount it - glog.V(12).Infof(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", "")) + glog.V(5).Infof(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", "")) err := rc.operationExecutor.UnmountVolume( mountedVolume.MountedVolume, rc.actualStateOfWorld) if err != nil && @@ -191,7 +191,7 @@ func (rc *reconciler) reconcile() { if rc.controllerAttachDetachEnabled || !volumeToMount.PluginIsAttachable { // Volume is not attached (or doesn't implement attacher), kubelet attach is disabled, wait // for controller to finish attaching volume. - glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.VerifyControllerAttachedVolume", "")) + glog.V(5).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.VerifyControllerAttachedVolume", "")) err := rc.operationExecutor.VerifyControllerAttachedVolume( volumeToMount.VolumeToMount, rc.nodeName, @@ -214,7 +214,7 @@ func (rc *reconciler) reconcile() { VolumeSpec: volumeToMount.VolumeSpec, NodeName: rc.nodeName, } - glog.V(12).Infof(volumeToAttach.GenerateMsgDetailed("Starting operationExecutor.AttachVolume", "")) + glog.V(5).Infof(volumeToAttach.GenerateMsgDetailed("Starting operationExecutor.AttachVolume", "")) err := rc.operationExecutor.AttachVolume(volumeToAttach, rc.actualStateOfWorld) if err != nil && !nestedpendingoperations.IsAlreadyExists(err) && @@ -234,7 +234,7 @@ func (rc *reconciler) reconcile() { if isRemount { remountingLogStr = "Volume is already mounted to pod, but remount was requested." } - glog.V(12).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr)) + glog.V(4).Infof(volumeToMount.GenerateMsgDetailed("Starting operationExecutor.MountVolume", remountingLogStr)) err := rc.operationExecutor.MountVolume( rc.waitForAttachTimeout, volumeToMount.VolumeToMount, @@ -264,7 +264,7 @@ func (rc *reconciler) reconcile() { !rc.operationExecutor.IsOperationPending(attachedVolume.VolumeName, nestedpendingoperations.EmptyUniquePodName) { if attachedVolume.GloballyMounted { // Volume is globally mounted to device, unmount it - glog.V(12).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountDevice", "")) + glog.V(5).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountDevice", "")) err := rc.operationExecutor.UnmountDevice( attachedVolume.AttachedVolume, rc.actualStateOfWorld, rc.mounter) if err != nil && @@ -285,7 +285,7 @@ func (rc *reconciler) reconcile() { glog.Infof(attachedVolume.GenerateMsgDetailed("Volume detached", fmt.Sprintf("DevicePath %q", attachedVolume.DevicePath))) } else { // Only detach if kubelet detach is enabled - glog.V(12).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.DetachVolume", "")) + glog.V(5).Infof(attachedVolume.GenerateMsgDetailed("Starting operationExecutor.DetachVolume", "")) err := rc.operationExecutor.DetachVolume( attachedVolume.AttachedVolume, false /* verifySafeToDetach */, rc.actualStateOfWorld) if err != nil && diff --git a/pkg/volume/util/operationexecutor/operation_executor.go b/pkg/volume/util/operationexecutor/operation_executor.go index 486add34da..9ce8c11d1d 100644 --- a/pkg/volume/util/operationexecutor/operation_executor.go +++ b/pkg/volume/util/operationexecutor/operation_executor.go @@ -844,7 +844,7 @@ func (oe *operationExecutor) ReconstructVolumeOperation( // Filesystem Volume case if volumeMode == v1.PersistentVolumeFilesystem { // Create volumeSpec from mount path - glog.V(12).Infof("Starting operationExecutor.ReconstructVolumepodName") + glog.V(5).Infof("Starting operationExecutor.ReconstructVolumepodName") volumeSpec, err := plugin.ConstructVolumeSpec(volumeSpecName, mountPath) if err != nil { return nil, err @@ -854,7 +854,7 @@ func (oe *operationExecutor) ReconstructVolumeOperation( // Block Volume case // Create volumeSpec from mount path - glog.V(12).Infof("Starting operationExecutor.ReconstructVolume") + glog.V(5).Infof("Starting operationExecutor.ReconstructVolume") if mapperPlugin == nil { return nil, fmt.Errorf("Could not find block volume plugin %q (spec.Name: %q) pod %q (UID: %q)", pluginName, diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index 71d71ae5ed..0c52e269cd 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -549,7 +549,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc( simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.SetUp succeeded", "") verbosity := glog.Level(1) if isRemount { - verbosity = glog.Level(7) + verbosity = glog.Level(4) } else { og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeNormal, kevents.SuccessfulMountVolume, simpleMsg) } @@ -587,7 +587,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc( func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, devicePath, deviceMountPath, pluginName string) (simpleErr, detailedErr error) { if !utilfeature.DefaultFeatureGate.Enabled(features.ExpandPersistentVolumes) { - glog.V(6).Infof("Resizing is not enabled for this volume %s", volumeToMount.VolumeName) + glog.V(4).Infof("Resizing is not enabled for this volume %s", volumeToMount.VolumeName) return nil, nil } @@ -1063,7 +1063,7 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc( } // The block volume is not referenced from Pods. Release file descriptor lock. - glog.V(5).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath) + glog.V(4).Infof("UnmapDevice: deviceToDetach.DevicePath: %v", deviceToDetach.DevicePath) loopPath, err := og.blkUtil.GetLoopDevice(deviceToDetach.DevicePath) if err != nil { glog.Warningf(deviceToDetach.GenerateMsgDetailed("UnmapDevice: Couldn't find loopback device which takes file descriptor lock", fmt.Sprintf("device path: %q", deviceToDetach.DevicePath)))