Bug 1357776

Summary: Service is not re-enabled when increasing max_clients limit after it has been reached.
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: dyuan, mzhan, rbalakri, yafu, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-2.0.0-5.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:50:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fangge Jin 2016-07-19 06:56:35 UTC
Description of problem:
When max_clients limit has been reached, increase max_clients by "srv-clients-set --max-clients" at run time, then try to connect new virsh client to libvirtd, but it failed.

Version-Release number of selected component (if applicable):
libvirt-2.0.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Set max_clients limit in libvirtd.conf
max_clients = 2
max_anonymous_clients = 2

2. Restart libvirtd sevice

3. 
# virt-admin srv-clients-info libvirtd 
nclients_max        : 2
nclients            : 0
nclients_unauth_max : 2
nclients_unauth     : 0

4.Open two terminals, connect a virsh client in each terminal:
# virsh -c qemu:///system

5.
# virt-admin srv-clients-info libvirtd 
nclients_max        : 2
nclients            : 2
nclients_unauth_max : 2
nclients_unauth     : 0

6. Increase max_clients limit:
# virt-admin srv-clients-set libvirtd --max-clients 5

# virt-admin srv-clients-info libvirtd 
nclients_max        : 5
nclients            : 2
nclients_unauth_max : 5
nclients_unauth     : 0

7.Connect a new virsh client to libvirtd:
# virsh -c qemu:///system
(hangs)

8.Quit an existing virsh client which is connected in step 4:
virsh # quit

9. Check the virsh client in step7, it's connected successfully
# virsh -c qemu:///system
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # 


Actual results:
In step 7, virsh client didn't connect to libvirtd successfully.

Expected results:
New virsh client can connect to libvirtd successfully after increasing max_clients limit at run time.

Comment 2 Erik Skultety 2016-08-02 13:33:14 UTC
Fixed upstream by:

commit e9ce8a7d24a94f0be19705ae0e63aaa054c39e88
Author:     Erik Skultety <eskultet>
AuthorDate: Wed Jul 20 12:10:29 2016 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Tue Aug 2 14:51:13 2016 +0200

    admin: rpc: virnetserver: Fix updating of the client limits
    
    Commit 2737aaaf changed our policy for accepting new clients in a way, that
    instead of accepting new clients only to disconnect them immediately, since
    that would overcommit the limit, we temporarily disable polling for the
    dedicated file descriptor, so any new connection will queue on the socket.
    Commit 8b1f0469 then added the possibility to change the limits during runtime
    but it didn't re-enable polling for the previously disabled file descriptor,
    thus any new connection would still continue to queue on the socket. This patch
    forces an update of the services each time the limits were changed in some way.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1357776
    
    Signed-off-by: Erik Skultety <eskultet>

Comment 5 yafu 2016-08-15 10:39:52 UTC
Reproduced with libvirt-2.0.0-2.el7.x86_64.
Test steps are as comment 0.


Verified pass with libvirt-2.0.0-5.el7.x86_64.
Test steps:
1.Set max_clients limit in libvirtd.conf
max_clients = 2
max_anonymous_clients = 2

2. Restart libvirtd sevice

3. #virt-admin srv-clients-info libvirtd 
nclients_max        : 2
nclients            : 0
nclients_unauth_max : 2
nclients_unauth     : 0

4.Open two terminals, connect a virsh client in each terminal:
# virsh -c qemu:///system

5.# virt-admin srv-clients-info libvirtd 
nclients_max        : 2
nclients            : 2
nclients_unauth_max : 2
nclients_unauth     : 0

6. Increase max_clients limit:
# virt-admin srv-clients-set libvirtd --max-clients 5

7# virt-admin srv-clients-info libvirtd 
nclients_max        : 5
nclients            : 2
nclients_unauth_max : 5
nclients_unauth     : 0

8.Connect 3 new virsh client to libvirtd, all connect correctly:
# virsh -c qemu:///system


9.Connect another new virsh client to libvirtd:
#virsh -c qemu:///system
(hangs)

Comment 7 errata-xmlrpc 2016-11-03 18:50:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2577.html