From da01b0c09c906a08da4cb11de47970e6f2f56dd9 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Wed, 15 Aug 2018 13:44:07 -0500 Subject: [PATCH] Libvirt: gracefully shutdown libvirt process on container stop. This PS gracefully shutdowns the libvirt process on pod termiantion. Change-Id: I4f7f2cac2e2a8586f5c40ac1ad556be74e29459a Signed-off-by: Pete Birley --- libvirt/templates/daemonset-libvirt.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libvirt/templates/daemonset-libvirt.yaml b/libvirt/templates/daemonset-libvirt.yaml index 1f3f3faa..051f3ac5 100644 --- a/libvirt/templates/daemonset-libvirt.yaml +++ b/libvirt/templates/daemonset-libvirt.yaml @@ -121,6 +121,14 @@ spec: {{ end }} command: - /tmp/libvirt.sh + lifecycle: + preStop: + exec: + command: + - bash + - -c + - |- + kill $(cat /var/run/libvirtd.pid) volumeMounts: - name: libvirt-bin mountPath: /tmp/libvirt.sh