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 <mario.loriedo@gmail.com>
(cherry picked from commit f25cefcb1b)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Mario Loriedo 2025-05-26 14:12:03 +02:00 committed by Paul Holzinger
parent 61403afeaf
commit efa20372b4
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
2 changed files with 12 additions and 0 deletions

View File

@ -90,6 +90,13 @@ var _ = Describe("run basic podman commands", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(runAlp).To(Exit(0)) Expect(runAlp).To(Exit(0))
// Test overlay works on all platforms except Hyper-V (see #26210)
if !isVmtype(define.HyperVVirt) {
runAlp, err = mb.setCmd(bm.withPodmanCommand([]string{"run", "-v", tDir + ":/test:O", TESTIMAGE, "ls", "/test/attr-test-file"})).run()
Expect(err).ToNot(HaveOccurred())
Expect(runAlp).To(Exit(0))
}
// Test build with --volume option // Test build with --volume option
cf := filepath.Join(tDir, "Containerfile") cf := filepath.Join(tDir, "Containerfile")
err = os.WriteFile(cf, []byte("FROM "+TESTIMAGE+"\nRUN ls /test/attr-test-file\n"), 0o644) err = os.WriteFile(cf, []byte("FROM "+TESTIMAGE+"\nRUN ls /test/attr-test-file\n"), 0o644)

View File

@ -157,6 +157,11 @@ func parseVolumes(rtc *config.Config, volumeFlag, mountFlag, tmpfsFlag []string)
} }
finalOverlayVolume := make([]*specgen.OverlayVolume, 0, len(overlayVolumes)) finalOverlayVolume := make([]*specgen.OverlayVolume, 0, len(overlayVolumes))
for _, volume := range overlayVolumes { for _, volume := range overlayVolumes {
absSrc, err := specgen.ConvertWinMountPath(volume.Source)
if err != nil {
return nil, fmt.Errorf("getting absolute path of %s: %w", volume.Source, err)
}
volume.Source = absSrc
finalOverlayVolume = append(finalOverlayVolume, volume) finalOverlayVolume = append(finalOverlayVolume, volume)
} }
finalImageVolumes := make([]*specgen.ImageVolume, 0, len(unifiedContainerMounts.imageVolumes)) finalImageVolumes := make([]*specgen.ImageVolume, 0, len(unifiedContainerMounts.imageVolumes))