Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1820469

Summary: [machines] vms can not be listed occasionally when enabling libvirt polkit
Product: Red Hat Enterprise Linux 7 Reporter: Xianghua Chen <xchen>
Component: cockpitAssignee: Katerina Koukiou <kkoukiou>
Status: CLOSED DUPLICATE QA Contact: Xianghua Chen <xchen>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.8CC: laurent, mpitt, wshi, ymao, yunyang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-08-06 13:18:49 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 Xianghua Chen 2020-04-03 07:07:21 UTC
Description of problem:
vms can not be listed occasionally when enabling libvirt polkit

Version-Release number of selected component (if applicable):
cockpit-machines-195.8-1.el7_8.noarch
libvirt-dbus-1.3.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a RHEL7.8 env with cockpit&libvirt. Login the cockpit web console with root, prepare 22 VMs.
I use guestfish do this:
# cd /tmp
# for (( i=1; i<=22; i++ )); do { guestfish -N test$i.img=fs & }; done

2.  Create user sysadmin and add it to libvirt and libvirtdbus groups:
# useradd -G libvirt,libvirtdbus sysadmin
# passwd sysadmin

3. Login the cockpit web console use sysadmin

4. Change configuration in libvirt.conf:
# vi /etc/libvirt/libvirtd.conf
access_drivers = [ "polkit" ]

5. Restart libvirtd:
# systemctl restart libvirtd

6. Refresh the cockpit page several times

Actual results:
Vms can not be listed ocassinally (about 1-2 times per 10 times refresh)

Expected results:
Vms can be listed

Additional info:
More info please refer to bug: https://bugzilla.redhat.com/show_bug.cgi?id=1780400
The problem also exist when using root to login.
The reason is that if UI does not get a reply from libvirt after 30 seconds, then it gives up, use polkit in the step to have more than 30s' reply.
At least to show what's happening to user if we don't have better fix for it.

Comment 1 Martin Pitt 2020-04-03 08:13:52 UTC
I suggest to first spend some time on finding out why it takes so long in the first place -- 10 to 20 seconds to list 20 VMs seems excessive, that smells like a bug somewhere in the stack (cockpit → libvirt-dbus → libvirt → polkit). Especially as Xianghua tested this with a root login, so the permission check should be super-quick.

Comment 4 Martin Pitt 2020-08-06 13:18:49 UTC
I'm duplicating this to the older bug. It's the same symptom, likely the same cause, and the same set of people are talking on both bugs.

*** This bug has been marked as a duplicate of bug 1780400 ***

Comment 5 Xianghua Chen 2020-08-07 05:46:14 UTC
(In reply to Martin Pitt from comment #4)
> I'm duplicating this to the older bug. It's the same symptom, likely the
> same cause, and the same set of people are talking on both bugs.
> 
> *** This bug has been marked as a duplicate of bug 1780400 ***

I filed this bug per the discussion in Comment 40 & Comment 41 in bug1780400 to get the early fix released.
But indeed the comments are added into both bugs, just feel free to reopen this one or the original one to track further fixes at last, thanks.