From a62da3e22b1d30050916e6999c7d481e5acbe7d4 Mon Sep 17 00:00:00 2001 From: NickrenREN Date: Fri, 23 Dec 2016 09:51:44 +0800 Subject: [PATCH] record ReduceCPULimits result err info if possible record ReduceCPULimits result err info if possible --- pkg/kubelet/kubelet_pods.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/kubelet/kubelet_pods.go b/pkg/kubelet/kubelet_pods.go index 34fdd8d6787..ad5a42d9782 100644 --- a/pkg/kubelet/kubelet_pods.go +++ b/pkg/kubelet/kubelet_pods.go @@ -649,13 +649,13 @@ func (kl *Kubelet) killPod(pod *v1.Pod, runningPod *kubecontainer.Pod, status *k // cache the pod cgroup Name for reducing the cpu resource limits of the pod cgroup once the pod is killed pcm := kl.containerManager.NewPodContainerManager() var podCgroup cm.CgroupName - reduceCpuLimts := true + reduceCpuLimits := true if pod != nil { podCgroup, _ = pcm.GetPodContainerName(pod) } else { // If the pod is nil then cgroup limit must have already // been decreased earlier - reduceCpuLimts = false + reduceCpuLimits = false } // Call the container runtime KillPod method which stops all running containers of the pod @@ -670,8 +670,10 @@ func (kl *Kubelet) killPod(pod *v1.Pod, runningPod *kubecontainer.Pod, status *k // Hence we only reduce the cpu resource limits of the pod's cgroup // and defer the responsibilty of destroying the pod's cgroup to the // cleanup method and the housekeeping loop. - if reduceCpuLimts { - pcm.ReduceCPULimits(podCgroup) + if reduceCpuLimits { + if err := pcm.ReduceCPULimits(podCgroup); err != nil { + glog.Warningf("Failed to reduce the CPU values to the minimum amount of shares: %v", err) + } } return nil }