Improve comments for when hostPath in Windows needs to be transformed

Signed-off-by: Deep Debroy <ddebroy@docker.com>
This commit is contained in:
Deep Debroy 2018-10-25 13:58:16 -07:00
parent f8a69f1086
commit 2e19f70922

View File

@ -219,6 +219,8 @@ func makeMounts(pod *v1.Pod, podDir string, container *v1.Container, hostName, h
containerPath := mount.MountPath containerPath := mount.MountPath
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
// Append C: only if it looks like a local path. Do not process UNC path/SMB shares/named pipes // Append C: only if it looks like a local path. Do not process UNC path/SMB shares/named pipes
// NOTE: strings.HasPrefix(hostPath, "\\") checks for prefix "\" as in "\foo\bar" and not "\\foo\bar"
// IsWindowsUNCPath checks for prefix "\\" as in "\\foo\bar" and not "\foo\bar"
if (strings.HasPrefix(hostPath, "/") || strings.HasPrefix(hostPath, "\\")) && !strings.Contains(hostPath, ":") && !volumeutil.IsWindowsUNCPath(runtime.GOOS, hostPath) { if (strings.HasPrefix(hostPath, "/") || strings.HasPrefix(hostPath, "\\")) && !strings.Contains(hostPath, ":") && !volumeutil.IsWindowsUNCPath(runtime.GOOS, hostPath) {
hostPath = "c:" + hostPath hostPath = "c:" + hostPath
} }