[libvirt] [PATCH] tools: skip libvirt-guests fast if libvirtd is not active
Doug Smythies
dsmythies at telus.net
Tue Dec 3 17:59:27 UTC 2019
On 2019.12.03 00:56 Christian Ehrhardt wrote:
> The most common operation of libvirt-guests is to manage the local
> libvirtd. But users might have disabled that and while we are
> After=libvirtd for ordering we are not Requiring it..
> OTOH adding that or any harder dependency might affect our ordering.
>
> But if people have disabled libvirt they will do a full retry loop
> until timeout. Lets check if the local service is active at all and skip
> fast if it is not.
>
> Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1854653
>
> Reported-by: Doug Smythies <dsmythies at telus.net>
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
Tested-by: Doug Smythies <dsmythies at telus.net>
Thanks.
> ---
> tools/libvirt-guests.sh.in | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
> index 4bc6e866f0..5a9930ee2f 100644
> --- a/tools/libvirt-guests.sh.in
> +++ b/tools/libvirt-guests.sh.in
> @@ -90,6 +90,14 @@ test_connect()
> {
> uri=$1
>
> + if [ "x$uri" = xdefault ]; then
> + # Default config is most common and for the local libvirtd
> + # Check if it is active before wasting time in connect loop
> + if ! systemctl -q is-active libvirtd; then
> + return 1
> + fi
> + fi
> +
> i=${CONNECT_RETRIES}
> while [ $i -gt 0 ]; do
> run_virsh "$uri" connect 2>/dev/null
> --
> 2.24.0
More information about the libvir-list
mailing list