[libvirt] [PATCH v2 0/1] speed up libvirt-guests

2019-12-15 Thread Christian Ehrhardt
After discussing a fast-skip for local connections we got to the idea
that the loop is droppable. So let us give that approach a review on the
list.

Updates in v2:
- stop fastpathing if the systemd service is down
- instead drop the rety loop entirely

Christian Ehrhardt (1):
  tools: do not loop in libvirt-guests test_connect

 tools/libvirt-guests.sh.in | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

-- 
2.24.1


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



[libvirt] [PATCH v2 1/1] tools: do not loop in libvirt-guests test_connect

2019-12-15 Thread Christian Ehrhardt
These days libvirt is pretty reliable and even remote connections
(not the default for libvirt-guests anyway) either work or fail but are
uncommon to be flaky.

On the other hand users might have disabled the service and while we are
After=libvirtd for ordering we are not Requiring it. Adding that or any
harder dependency might break our ordering. But if people have disabled
libvirt they will do a full retry loop until timeout.

Lets drop the loop to be much faster if a remote is not reachable.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1854653

Reported-by: Doug Smythies 
Signed-off-by: Christian Ehrhardt 
---
 tools/libvirt-guests.sh.in | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index 4bc6e866f0..a881f6266e 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -37,8 +37,6 @@ SHUTDOWN_TIMEOUT=300
 PARALLEL_SHUTDOWN=0
 START_DELAY=0
 BYPASS_CACHE=0
-CONNECT_RETRIES=10
-RETRIES_SLEEP=1
 SYNC_TIME=0
 
 test -f "$sysconfdir"/sysconfig/libvirt-guests &&
@@ -90,19 +88,12 @@ test_connect()
 {
 uri=$1
 
-i=${CONNECT_RETRIES}
-while [ $i -gt 0 ]; do
-run_virsh "$uri" connect 2>/dev/null
-if [ $? -eq 0 ]; then
-return 0;
-fi
-sleep ${RETRIES_SLEEP}
-eval_gettext "Unable to connect to libvirt currently. Retrying .. \$i"
-i=$(($i-1))
-done
-eval_gettext "Can't connect to \$uri. Skipping."
-echo
-return 1
+if run_virsh "$uri" connect 2>/dev/null; then
+return 0;
+else
+eval_gettext "Can't connect to \$uri. Skipping."
+return 1
+fi
 }
 
 # list_guests URI PERSISTENT
-- 
2.24.1


--
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

2019-12-15 Thread Christian Ehrhardt
On Fri, Dec 13, 2019 at 11:23 AM Daniel P. Berrangé 
wrote:

> On Tue, Dec 03, 2019 at 09:56:15AM +0100, 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.
>
> I don't really get why we have that retry logic at all.
> If libvirtd is running, or systemd autostart is present then
> virsh connect should work immediately.  If it autostarts and
> no guests are present, then ther's no work todo so it'll be
> fast enough.
>
> If it fails something either it is stopped and autostart is
> disabled, or it is completely broken.
>
> Either way,  a retry loop looks pointless to me.
>

Yeah I agree and thank you for that POV.
Maybe the loop sits there since more unreliable times and just is outdated
now.


> IOW, instead of adding a check on libvirtd, just
> kill the retry loop.
>
>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-
> https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-
> https://www.instagram.com/dberrange :|
>
>

-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd
--
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

2019-12-15 Thread Christian Ehrhardt
On Thu, Dec 12, 2019 at 7:04 PM Michal Privoznik 
wrote:

> On 12/3/19 9:56 AM, 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 
> > Signed-off-by: Christian Ehrhardt 
> > ---
> >   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
>
> Systemd is still not the only init out there:
>
> moe ~ # systemctl -q is-active libvirtd
> -su: systemctl: command not found
>
> However, this will make libvirt-guests unusable when using split daemons
> (which are not enabled yet). So I guess we need to check whether either
> libvirtd or any of the hypervisor daemons is running (we can't assume
> the default URI is qemu:///system).


Just for completeness - we can assume that because that is what the
["x$uri" = xdefault] check is for.
For any non default cases it would have not tried to fast path it.

But I like Daniels suggestion of maybe just dropping the retry logic on
this one.
Therefore consider this patch obsolete and I'll send a very different v2
somewhen later.

Also, it would be nice to print a
> message why we tested connection unusable. Something like:
>
>eval_gettext "Libvirtd is not running. Skipping."
>return 1
>
> Michal
>
>

-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] cpu: add CLZERO CPUID support for AMD platforms (libvirt 4.5)

2019-12-15 Thread Ani Sinha
Hi all :

Can I get some love for this patch?

thanks
ani

On Dec 3, 2019, 4:49 PM +0530, Ani Sinha , wrote:
Qemu commit e900135dcfb67 ("i386: Add CPUID bit for CLZERO and XSAVEERPTR")
adds support for CLZERO CPUID bit. This commit extends support for this
bit in libvirt.

This patch is based off of libvirt-4.5 tree.

Signed-off-by: Ani Sinha 

---
src/cpu/cpu_map.xml | 5 +
1 file changed, 5 insertions(+)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 088c820..c251cb7 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -431,6 +431,9 @@



+ 
+ 
+ 



@@ -1685,6 +1688,7 @@



+ 



@@ -1756,6 +1760,7 @@



+ 



--
1.9.4

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