Exec libvirt even when creating secrets

With "hostPid: true" we want the entrypoint process to be libvirtd not a wrapper so that process lifecycle management works as expected.

The fix for now is

  * start libvirtd
  * create secrets (libvirtd needs to be running for this)
  * kill it

then start it again using exec so libvirtd is the entrypoint pid
and container lifecycle should work as expected.

Change-Id: I9ef8a66da0fba70e8db4be3301833263de0617e8
This commit is contained in:
Ritchie, Frank (fr801x) 2022-03-17 13:06:20 -05:00 committed by Frank Ritchie
parent b34409b7c3
commit ec69dd0ef9
3 changed files with 12 additions and 6 deletions

View File

@ -15,7 +15,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm libvirt
name: libvirt
version: 0.1.8
version: 0.1.9
home: https://libvirt.org
sources:
- https://libvirt.org/git/?p=libvirt.git;a=summary

View File

@ -169,9 +169,14 @@ EOF
create_virsh_libvirt_secret ${EXTERNAL_CEPH_CINDER_USER} ${LIBVIRT_EXTERNAL_CEPH_CINDER_SECRET_UUID} ${EXTERNAL_CEPH_CINDER_KEYRING}
fi
# rejoin libvirtd
wait
else
#NOTE(portdirect): run libvirtd as a transient unit on the host with the osh-libvirt cgroups applied.
exec cgexec -g ${CGROUPS%,}:/osh-libvirt systemd-run --scope --slice=system libvirtd --listen
cleanup
# stop libvirtd; we needed it up to create secrets
LIBVIRTD_PID=$(cat /var/run/libvirtd.pid)
kill $LIBVIRTD_PID
tail --pid=$LIBVIRTD_PID -f /dev/null
fi
#NOTE(portdirect): run libvirtd as a transient unit on the host with the osh-libvirt cgroups applied.
exec cgexec -g ${CGROUPS%,}:/osh-libvirt systemd-run --scope --slice=system libvirtd --listen

View File

@ -9,4 +9,5 @@ libvirt:
- 0.1.6 Enhancement to enable probes override from values.yaml
- 0.1.7 Add libvirt overrides for Victoria and Wallaby
- 0.1.8 Update htk requirements
- 0.1.9 Exec libvirt instead of forking from bash
...