Use osInterface for Create

pull/6/head
Pengfei Ni 2016-10-26 17:51:20 +08:00
parent b1d8961fe4
commit 375660b931
1 changed files with 3 additions and 4 deletions

View File

@ -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 {