Merge pull request #17202 from brendandburns/fix2

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2015-11-17 00:49:13 -08:00
8 changed files with 22 additions and 15 deletions

View File

@@ -24,10 +24,10 @@ import (
"strings"
)
type ProcFs struct{}
type ProcFS struct{}
func NewProcFs() ProcFsInterface {
return &ProcFs{}
func NewProcFS() ProcFSInterface {
return &ProcFS{}
}
func containerNameFromProcCgroup(content string) (string, error) {
@@ -44,7 +44,7 @@ func containerNameFromProcCgroup(content string) (string, error) {
// getFullContainerName gets the container name given the root process id of the container.
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
func (pfs *ProcFs) GetFullContainerName(pid int) (string, error) {
func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) {
filePath := path.Join("/proc", strconv.Itoa(pid), "cgroup")
content, err := ioutil.ReadFile(filePath)
if err != nil {

View File

@@ -16,15 +16,15 @@ limitations under the License.
package procfs
type FakeProcFs struct{}
type FakeProcFS struct{}
func NewFakeProcFs() ProcFsInterface {
return &FakeProcFs{}
func NewFakeProcFS() ProcFSInterface {
return &FakeProcFS{}
}
// getFullContainerName gets the container name given the root process id of the container.
// GetFullContainerName gets the container name given the root process id of the container.
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
func (fakePfs *FakeProcFs) GetFullContainerName(pid int) (string, error) {
func (fakePfs *FakeProcFS) GetFullContainerName(pid int) (string, error) {
return "", nil
}

View File

@@ -16,7 +16,7 @@ limitations under the License.
package procfs
type ProcFsInterface interface {
// getFullContainerName gets the container name given the root process id of the container.
type ProcFSInterface interface {
// GetFullContainerName gets the container name given the root process id of the container.
GetFullContainerName(pid int) (string, error)
}

View File

@@ -27,9 +27,14 @@ const (
sysctlBase = "/proc/sys"
VmOvercommitMemory = "vm/overcommit_memory"
VmPanicOnOOM = "vm/panic_on_oom"
KernelPanic = "kernel/panic"
KernelPanicOnOops = "kernel/panic_on_oops"
VmOvercommitMemoryAlways = 1 // kernel performs no memory over-commit handling
VmPanicOnOOMInvokeOOMKiller = 0 // kernel calls the oom_killer function when OOM occurs
KernelPanicOnOopsAlways = 1 // kernel panics on kernel oops
KernelPanicRebootTimeout = 10 // seconds after a panic for the kernel to reboot
)
// GetSysctl returns the value for the specified sysctl setting