Change ID I128bf6b939 (libvirt: handle code=38 + sigkill (ebusy) in
_destroy()) handled the case where a QEMU process "refuses to die" within
a given timeout period set by libvirt.
Originally, libvirt sent SIGTERM (allowing the process to clean-up
resources), then waited 10 seconds, if the guest didn't go away. Then
it sent, the more lethal, SIGKILL and waited another 5 seconds for it to
take effect.
From libvirt v4.7.0 onwards, libvirt increased[1][2] the time it waits
for a guest hard shutdown to complete. It now waits for 30 seconds for
SIGKILL to work (instead of 5). Also, additional wait time is added if
there are assigned PCI devices, as some of those tend to slow things
down.
In this change:
- Increment the counter to retry the _destroy() call from 3 to 6, thus
increasing the total time from 15 to 30 seconds, before SIGKILL
takes effect. And it matches the (more graceful) behaviour of
libvirt v4.7.0. This also gives breathing room for Nova instances
running in environments with large compute nodes with high instance
creation or delete churn, where the current timout may not be
sufficient.
- Retry the _destroy() API call _only_ if MIN_LIBVIRT_VERSION is lower
than 4.7.0.
Reviewed: https:/ /review. opendev. org/668111 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=16b0fb01afa c7b81094aa89158 8f4bd9017ee235
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 16b0fb01afac7b8 1094aa891588f4b d9017ee235
Author: Kashyap Chamarthy <email address hidden>
Date: Mon Feb 25 13:26:24 2019 +0100
libvirt: Rework 'EBUSY' (SIGKILL) error handling code path
Change ID I128bf6b939 (libvirt: handle code=38 + sigkill (ebusy) in
_destroy()) handled the case where a QEMU process "refuses to die" within
a given timeout period set by libvirt.
Originally, libvirt sent SIGTERM (allowing the process to clean-up
resources), then waited 10 seconds, if the guest didn't go away. Then
it sent, the more lethal, SIGKILL and waited another 5 seconds for it to
take effect.
From libvirt v4.7.0 onwards, libvirt increased[1][2] the time it waits
for a guest hard shutdown to complete. It now waits for 30 seconds for
SIGKILL to work (instead of 5). Also, additional wait time is added if
there are assigned PCI devices, as some of those tend to slow things
down.
In this change:
- Increment the counter to retry the _destroy() call from 3 to 6, thus
increasing the total time from 15 to 30 seconds, before SIGKILL
takes effect. And it matches the (more graceful) behaviour of
libvirt v4.7.0. This also gives breathing room for Nova instances
running in environments with large compute nodes with high instance
creation or delete churn, where the current timout may not be
sufficient.
- Retry the _destroy() API call _only_ if MIN_LIBVIRT_VERSION is lower
than 4.7.0.
[1] https:/ /libvirt. org/git/ ?p=libvirt. git;a=commitdif f;h=9a4e4b9 /libvirt. org/git/ ?p=libvirt. git;a=commit; h=be2ca04 ("process:
(process: wait longer 5->30s on hard shutdown)
[2] https:/
wait longer on kill per assigned Hostdev")
Conflicts:
nova/virt/ libvirt/ driver. py
(Trivial conflict: Rocky didn't have the QEMU-native TLS feature
yet.)
Conflicts (stable/queens):
nova/tests/ unit/virt/ libvirt/ test_driver. py
Related-bug: #1353939
Change-Id: If2035cac931c42 c440d61ba97ebc7 e9e92141a28 aeae84cb9bd5d18 895948af54) 9efb90d4fa9f046 631766c14c)
Signed-off-by: Kashyap Chamarthy <email address hidden>
(cherry picked from commit 10d50ca4e210039
(cherry picked from commit 75985e25bc14736