[libvirt] [PATCH] tools: skip libvirt-guests fast if libvirtd is not active

Christian Ehrhardt posted 1 patch 5 days ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20191203085615.4016-1-christian.ehrhardt@canonical.com
tools/libvirt-guests.sh.in | 8 ++++++++
1 file changed, 8 insertions(+)

[libvirt] [PATCH] tools: skip libvirt-guests fast if libvirtd is not active

Posted by Christian Ehrhardt 5 days ago
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@telus.net>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 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


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tools: skip libvirt-guests fast if libvirtd is not active

Posted by Doug Smythies 5 days ago
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@telus.net>
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>

Tested-by: Doug Smythies <dsmythies@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



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list