Bug 1705516 - Provide info from guest-get-users QEMU-GA command
Summary: Provide info from guest-get-users QEMU-GA command
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jonathon Jongsma
QA Contact: Lili Zhu
URL:
Whiteboard:
: 1704761 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-02 12:44 UTC by Tomáš Golembiovský
Modified: 2020-05-12 10:08 UTC (History)
6 users (show)

Fixed In Version: libvirt-5.9.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-05 09:45:18 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:2017 0 None None None 2020-05-05 09:46:07 UTC

Description Tomáš Golembiovský 2019-05-02 12:44:43 UTC
Please include output of guest-get-users QEMU-GA command into bulk stats
reported for domains. This feature is required for efficient consumption of
qemu-ga info in oVirt.

Comment 1 Jonathon Jongsma 2019-08-30 19:42:53 UTC
User info was included in virDomainGetGuestInfo() patches which have been merged upstream.

Comment 4 Lili Zhu 2019-12-03 08:50:46 UTC
Hi, Jonathon

The guest bulk stats now does not contain any info about guest users 

version:
libvirt-5.9.0-4.module+el8.2.0+4836+a8e32ad7.x86_64

# virsh domstats lizhu |grep user
  cpu.user=3300000000  <=== does not contain the info guest users

And I noticed there are same issues in the other similar bugs about 
"Provide info from guest-get-* QEMU-GA command in bulk stats",

Please help to check. Thanks

Comment 5 Jonathon Jongsma 2019-12-03 16:27:39 UTC
This information is returned in the new 'guestinfo' command.

Comment 6 Lili Zhu 2019-12-04 05:12:36 UTC
Hi, Jonathon

Is there anything else I need to pay attention to when I verify this bug, since 
now the bug looks almost the same with https://bugzilla.redhat.com/show_bug.cgi?id=1704761

Thanks

Comment 7 Jonathon Jongsma 2019-12-05 16:48:19 UTC
Hmm, you're right. That's a good question...

Perhaps originally Tomas envisioned having two separate libvirt interfaces to obtain this information: one dedicated API (e.g. something like virDomainGetGuestUsers()) and also included in the bulk stats output. So perhaps that bug was for adding the dedicated API and this one was to include it in the bulk stats? In the end, the solution was neither of these. We introduced a new 'bulk' guest info API (virDomainGetGuestInfo())

Another possible explanation for the two bugs is that maybe one was intended to be filed against a different component or product? 

Tomas, do you have any idea about the difference between these two bugs?

Comment 8 Tomáš Golembiovský 2019-12-10 15:18:31 UTC
You're right Jonathon, the original idea was to have API call for every guest-get-* QEMU-GA command and then also provide the unified access to all the information via bulk stats. As you say the resulting implementation is totally different so feel free to close or change the description of all the other bugs.

By the way, is the new API properly reflected in libvirt-python or is there anything more we need to do?

Comment 9 Jonathon Jongsma 2019-12-10 19:55:16 UTC
I don't have a lot of experience with libvirt-python, but I believe that the libvirt-python API is mostly auto-generated, so this function should be included in a new release.

Comment 10 Jonathon Jongsma 2019-12-10 20:50:17 UTC
*** Bug 1704761 has been marked as a duplicate of this bug. ***

Comment 11 Jonathon Jongsma 2019-12-10 20:51:26 UTC
Per comments above, I've closed bug 1704761 as a duplicate

Comment 13 Lili Zhu 2020-02-03 07:10:33 UTC
Verify this bug with:
libvirt-6.0.0-2.module+el8.2.0+5513+34927b6c.x86_64
qemu-guest-agent-4.2.0-8.module+el8.2.0+5607+dc756904.x86_64

A) positive scenarios:
1) prepare one rhel and one linux guest
# virsh list --all
 Id   Name                       State
-------------------------------------------
 2    rhel8.2                    running
 3    win10                      running

2) login guest with root and non-root users
[root@newhost ~]# last -F
root     ttyS0                         Mon Feb  3 14:00:16 2020   still logged in
root     ttyS0                         Mon Feb  3 13:59:45 2020 - Mon Feb  3 14:00:04 2020  (00:00)
lizhu    tty1                          Mon Feb  3 12:21:01 2020   still logged in

3) check the active users
# virsh guestinfo --user rhel8.2 
user.count          : 2
user.0.name         : root
user.0.login-time   : 1580709616555
user.1.name         : lizhu
user.1.login-time   : 1580703661621

4) check the login time of the 2 users
for root:
# date  -d @1580709616.555
Mon Feb  3 14:00:16 CST 2020
for lizhu:
# date -d @1580703661.621
Mon Feb  3 12:21:01 CST 2020

5) logout lizhu
check the active user
# virsh guestinfo --user rhel8.2 
user.count          : 1
user.0.name         : root
user.0.login-time   : 1580709616555

6) check the active users of windows guest
# virsh guestinfo --user win10
user.count          : 1
user.0.name         : test
user.0.domain       : WIN10-GUEST
user.0.login-time   : 1580705292340

7) check the login time
# date -d @1580705292.340
Mon Feb  3 12:48:12 CST 2020

8) query user in windows guest
C:\Users\test>query user
 USERNAME              SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
>test                  console             1  Active      none   2/3/2020 12:48 PM

9)logout user test
# virsh guestinfo --user win10
user.count          : 0

A) negative scenarios:
1) stop guest agent service in guest, check the active users in guest
# virsh guestinfo --user win10
error: Guest agent is not responding: QEMU guest agent is not connected

2) check active users under readonly mode
# virsh -r guestinfo --user win10
error: operation forbidden: read only access prevents virDomainGetGuestInfo

3) check active users when guest agent is not configured
# virsh guestinfo --user win10
error: argument unsupported: QEMU guest agent is not configured

Comment 14 Lili Zhu 2020-02-21 03:02:04 UTC
As the testing match with expected results, mark the bug as verified

Comment 16 errata-xmlrpc 2020-05-05 09:45:18 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://access.redhat.com/errata/RHBA-2020:2017


Note You need to log in before you can comment on or make changes to this bug.