From 375660b93104100cf9e94b6e501ea2c334ee6cb0 Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Wed, 26 Oct 2016 17:51:20 +0800 Subject: [PATCH] Use osInterface for Create --- pkg/kubelet/kuberuntime/kuberuntime_container.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_container.go b/pkg/kubelet/kuberuntime/kuberuntime_container.go index 83727d56884..af6da2d40d4 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_container.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_container.go @@ -150,7 +150,7 @@ func (m *kubeGenericRuntimeManager) generateContainerConfig(container *api.Conta WorkingDir: &container.WorkingDir, Labels: newContainerLabels(container, pod), Annotations: newContainerAnnotations(container, pod, restartCount), - Mounts: makeMounts(opts, container, podHasSELinuxLabel), + Mounts: m.makeMounts(opts, container, podHasSELinuxLabel), LogPath: &containerLogsPath, Stdin: &container.Stdin, StdinOnce: &container.StdinOnce, @@ -252,7 +252,7 @@ func (m *kubeGenericRuntimeManager) generateLinuxContainerConfig(container *api. } // makeMounts generates container volume mounts for kubelet runtime api. -func makeMounts(opts *kubecontainer.RunContainerOptions, container *api.Container, podHasSELinuxLabel bool) []*runtimeApi.Mount { +func (m *kubeGenericRuntimeManager) makeMounts(opts *kubecontainer.RunContainerOptions, container *api.Container, podHasSELinuxLabel bool) []*runtimeApi.Mount { volumeMounts := []*runtimeApi.Mount{} for idx := range opts.Mounts { @@ -278,8 +278,7 @@ func makeMounts(opts *kubecontainer.RunContainerOptions, container *api.Containe // of the same container. cid := makeUID() containerLogPath := filepath.Join(opts.PodContainerDir, cid) - // TODO: We should try to use os interface here. - fs, err := os.Create(containerLogPath) + fs, err := m.osInterface.Create(containerLogPath) if err != nil { glog.Errorf("Error on creating termination-log file %q: %v", containerLogPath, err) } else {