Skip to content

Commit f25cefc

Browse files
committed
Fix overlay volumes on Windows
The Windows source folder path was not converted in the corresponding machine folder path when the volume was of type overlay as it does for other bind mount volumes. Fix #25988 Signed-off-by: Mario Loriedo <[email protected]>
1 parent 10b8905 commit f25cefc

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/machine/e2e/basic_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ var _ = Describe("run basic podman commands", func() {
9090
Expect(err).ToNot(HaveOccurred())
9191
Expect(runAlp).To(Exit(0))
9292

93+
// Test overlay works on all platforms except Hyper-V (see #26210)
94+
if !isVmtype(define.HyperVVirt) {
95+
runAlp, err = mb.setCmd(bm.withPodmanCommand([]string{"run", "-v", tDir + ":/test:O", TESTIMAGE, "ls", "/test/attr-test-file"})).run()
96+
Expect(err).ToNot(HaveOccurred())
97+
Expect(runAlp).To(Exit(0))
98+
}
99+
93100
// Test build with --volume option
94101
cf := filepath.Join(tDir, "Containerfile")
95102
err = os.WriteFile(cf, []byte("FROM "+TESTIMAGE+"\nRUN ls /test/attr-test-file\n"), 0o644)

pkg/specgenutil/volumes.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ func parseVolumes(rtc *config.Config, volumeFlag, mountFlag, tmpfsFlag []string)
157157
}
158158
finalOverlayVolume := make([]*specgen.OverlayVolume, 0, len(overlayVolumes))
159159
for _, volume := range overlayVolumes {
160+
absSrc, err := specgen.ConvertWinMountPath(volume.Source)
161+
if err != nil {
162+
return nil, fmt.Errorf("getting absolute path of %s: %w", volume.Source, err)
163+
}
164+
volume.Source = absSrc
160165
finalOverlayVolume = append(finalOverlayVolume, volume)
161166
}
162167
finalImageVolumes := make([]*specgen.ImageVolume, 0, len(unifiedContainerMounts.imageVolumes))

0 commit comments

Comments
 (0)