Merge pull request #26282 from alaviss/push-wotrztyxpmou

quadlet: generate RequiresMountsFor for Type=bind volumes
This commit is contained in:
openshift-merge-bot[bot]
2025-06-10 09:02:32 +00:00
committed by GitHub
3 changed files with 13 additions and 2 deletions

View File

@@ -1115,6 +1115,9 @@ func ConvertVolume(volume *parser.UnitFile, name string, unitsInfoMap map[string
if ok && len(devType) != 0 {
if devValid {
podman.add("--opt", fmt.Sprintf("type=%s", devType))
if devType == "bind" {
service.Add(UnitGroup, "RequiresMountsFor", dev)
}
} else {
return nil, warnings, fmt.Errorf("key Type can't be used without Device")
}

View File

@@ -0,0 +1,9 @@
## assert-key-contains Service ExecStart " --opt type=bind "
## assert-key-contains Service ExecStart " --opt device=/var/lib/data "
## assert-key-contains Service ExecStart " --opt nocopy "
## assert-key-contains Unit RequiresMountsFor "/var/lib/data"
[Volume]
Device=/var/lib/data
Type=bind
Copy=no

View File

@@ -803,7 +803,6 @@ BOGUS=foo
dirName := "test_subdir"
err = CopyDirectory(filepath.Join("quadlet", dirName), quadletDir)
if err != nil {
GinkgoWriter.Println("error:", err)
}
@@ -975,6 +974,7 @@ BOGUS=foo
Entry("image.volume", "image.volume"),
Entry("Volume - global args", "globalargs.volume"),
Entry("Volume - Containers Conf Modules", "containersconfmodule.volume"),
Entry("Volume - Type=bind", "device-bind.volume"),
Entry("Absolute Path", "absolute.path.kube"),
Entry("Basic kube", "basic.kube"),
@@ -1276,5 +1276,4 @@ BOGUS=foo
},
),
)
})