]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_passt: Let passt write the PID file
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 16 Feb 2023 10:46:55 +0000 (11:46 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 20 Feb 2023 08:43:14 +0000 (09:43 +0100)
commit029a892abdb2fe508f3fb77af00a14464b98b824
tree444a8e23c974d87be6e9204c637e4df64cd41e9b
parente5bfc661bc181a36fa70250470554b20002fb84d
qemu_passt: Let passt write the PID file

The way we start passt currently is: we use
virCommandSetPidFile() to use our virCommand machinery to acquire
the PID file and leak opened FD into passt. Then, we use
virPidFile*() APIs to read the PID file (which is needed when
placing it into CGroups or killing it). But this does not fly
really because passt daemonizes itself. Thus the process we
started dies soon and thus the PID file is closed and unlocked.

We could work around this by passing '--foreground' argument, but
that weakens passt as it can't create new PID namespace (because
it doesn't fork()).

The solution is to let passt write the PID file, but since it
does not lock the file and closes it as soon as it is written, we
have to switch to those virPidFile APIs which don't expect PID
file to be locked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/qemu/qemu_passt.c