Skip to content

Generate RequiresMountsFor for Type=bind volumes #26125

@alaviss

Description

@alaviss

Feature request description

When using Quadlet, it's possible to abstract away a bind mount with a volume, like this:

data.volume:

[Volume]
Type=bind
Device=/var/lib/special-data

program.container:

[Container]
Image=docker.io/alpine:latest
Exec=tail -f /dev/null

Mount=data.volume:/data:z

This would allow shipping quadlet definitions in a system image, then on provisioning add drop-ins to override where the host mount point is (or to use regular managed volumes).

However, the generated volume units do not contain RequiresMountsFor (would be RequiresMountsFor=/var/lib/special-data in this case), which meant depending .container files will not wait for the referenced bind mount location to be available before starting.

Suggest potential solution

For Type=bind .volume, add the value of Device to RequiresMountsFor if it's an absolute path.

Have you considered any alternatives?

This can be manually done by adding RequiresMountsFor to the [Unit] section of .volume files, but it is prone to being out-of-sync with the actual Device definition.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.quadlettriagedIssue has been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions