quadlet: Use the new podman create volume --ignore
This way we don't have to use the `ExecCondition=podman volume exist`, which saves one process start. Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
parent
734c435e01
commit
b7f05cef0b
|
|
@ -659,11 +659,9 @@ func ConvertVolume(volume *parser.UnitFile, name string) (*parser.UnitFile, erro
|
||||||
// Need the containers filesystem mounted to start podman
|
// Need the containers filesystem mounted to start podman
|
||||||
service.Add(UnitGroup, "RequiresMountsFor", "%t/containers")
|
service.Add(UnitGroup, "RequiresMountsFor", "%t/containers")
|
||||||
|
|
||||||
execCond := fmt.Sprintf("/usr/bin/bash -c \"! /usr/bin/podman volume exists %s\"", volumeName)
|
|
||||||
|
|
||||||
labels := volume.LookupAllKeyVal(VolumeGroup, "Label")
|
labels := volume.LookupAllKeyVal(VolumeGroup, "Label")
|
||||||
|
|
||||||
podman := NewPodmanCmdline("volume", "create")
|
podman := NewPodmanCmdline("volume", "create", "--ignore")
|
||||||
|
|
||||||
var opts strings.Builder
|
var opts strings.Builder
|
||||||
opts.WriteString("o=")
|
opts.WriteString("o=")
|
||||||
|
|
@ -696,7 +694,6 @@ func ConvertVolume(volume *parser.UnitFile, name string) (*parser.UnitFile, erro
|
||||||
service.Setv(ServiceGroup,
|
service.Setv(ServiceGroup,
|
||||||
"Type", "oneshot",
|
"Type", "oneshot",
|
||||||
"RemainAfterExit", "yes",
|
"RemainAfterExit", "yes",
|
||||||
"ExecCondition", execCond,
|
|
||||||
|
|
||||||
// The default syslog identifier is the exec basename (podman) which isn't very useful here
|
// The default syslog identifier is the exec basename (podman) which isn't very useful here
|
||||||
"SyslogIdentifier", "%N")
|
"SyslogIdentifier", "%N")
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
## assert-key-is Unit RequiresMountsFor "%t/containers"
|
## assert-key-is Unit RequiresMountsFor "%t/containers"
|
||||||
## assert-key-is Service Type oneshot
|
## assert-key-is Service Type oneshot
|
||||||
## assert-key-is Service RemainAfterExit yes
|
## assert-key-is Service RemainAfterExit yes
|
||||||
## assert-key-is Service ExecCondition '/usr/bin/bash -c "! /usr/bin/podman volume exists systemd-basic"'
|
## assert-key-is Service ExecStart "/usr/bin/podman volume create --ignore systemd-basic"
|
||||||
## assert-key-is Service ExecStart "/usr/bin/podman volume create systemd-basic"
|
|
||||||
## assert-key-is Service SyslogIdentifier "%N"
|
## assert-key-is Service SyslogIdentifier "%N"
|
||||||
|
|
||||||
[Volume]
|
[Volume]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue