From 1080c9e5beba2dc9638eff250364d69d2a5793a2 Mon Sep 17 00:00:00 2001 From: Craig Anderson Date: Tue, 22 Aug 2017 19:59:24 +0000 Subject: [PATCH] Nova: Fix libvirtd PID check and error reporting Prevent false positive container exit from recycled libvirtd PID. Clarify error log message and fix exit code typo. Closes-Bug: #1711480 Change-Id: I47a7fdcb40b5c8153cf428e6863b618301abfd7c --- nova/templates/bin/_libvirt.sh.tpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nova/templates/bin/_libvirt.sh.tpl b/nova/templates/bin/_libvirt.sh.tpl index 72c44cda14..ff748b0ef2 100644 --- a/nova/templates/bin/_libvirt.sh.tpl +++ b/nova/templates/bin/_libvirt.sh.tpl @@ -19,8 +19,10 @@ limitations under the License. set -ex if [[ -f /var/run/libvirtd.pid ]]; then - test -d /proc/$(< /var/run/libvirtd.pid) && \ - ( echo "Libvirtd daemon is running" && exit 10 ) + LIBVIRTD_PID="$(< /var/run/libvirtd.pid)" + test -d "/proc/$LIBVIRTD_PID" && \ + test 'libvirtd' = "$(< /proc/$LIBVIRTD_PID/comm)" && \ + ( echo "ERROR: Libvirtd daemon is already running" && exit 1 ) fi rm -f /var/run/libvirtd.pid