Bug 1294777

Summary: virt-who should show some info after 60s if no host/guests changes for libvirt mode
Product: Red Hat Enterprise Linux 6 Reporter: Eko <hsun>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8CC: hsun, lmiksik, ovasik, rbalakri, sgao, shihliu
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.16-6.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 23:57:08 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 Eko 2015-12-30 09:58:40 UTC
Description of problem:
Now virt-who can check the host/guests updates after 60s, if there are some changes, virt-who will send the mapping info to server, if no changes, virt-who should output some message, such as:
"No change in report gathered using config: "env/cmdline", report not sent."

but for libvirt mode, virt-who can't print any message if no changes after 60s.


Version-Release number of selected component (if applicable):
virt-who-0.16-1.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. enable debug option
VIRTWHO_DEBUG=1

2. config virt-who for remote libvirt mode, such as:
VIRTWHO_LIBVIRT=1
VIRTWHO_LIBVIRT_OWNER=ACME_Corporation
VIRTWHO_LIBVIRT_ENV=Library
VIRTWHO_LIBVIRT_SERVER=10.66.144.8
VIRTWHO_LIBVIRT_USERNAME=root
VIRTWHO_LIBVIRT_PASSWORD=redhat


3. restart virt-who service and check rhsm.log
# /etc/init.d/virt-who restart
# tail -f /var/log/rhsm/rhsm.log

2015-12-30 17:54:22,769 [virtwho.init INFO] MainProcess(2775):MainThread @virtwho.py:main:811 - Using configuration "env/cmdline" ("libvirt" mode)
2015-12-30 17:54:22,785 [virtwho.main DEBUG] MainProcess(2777):MainThread @virtwho.py:run:287 - Starting infinite loop with 60 seconds interval
2015-12-30 17:54:22,888 [virtwho.env_cmdline DEBUG] Libvirtd-1(2785):MainThread @virt.py:run:338 - Virt backend 'env/cmdline' started
2015-12-30 17:54:22,890 [virtwho.env_cmdline INFO] Libvirtd-1(2785):MainThread @libvirtd.py:_get_url:124 - Protocol is not specified in libvirt url, using qemu+ssh://
2015-12-30 17:54:22,890 [virtwho.env_cmdline INFO] Libvirtd-1(2785):MainThread @libvirtd.py:_get_url:135 - Libvirt path is not specified in the url, using /system
2015-12-30 17:54:22,890 [virtwho.env_cmdline INFO] Libvirtd-1(2785):MainThread @libvirtd.py:_connect:156 - Using libvirt url: qemu+ssh://root.144.8/system?no_tty=1
2015-12-30 17:54:23,500 [virtwho.env_cmdline DEBUG] Libvirtd-1(2785):MainThread @libvirtd.py:_listDomains:228 - Virtual machine found: rhel7.2: cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede
2015-12-30 17:54:23,501 [virtwho.env_cmdline DEBUG] Libvirtd-1(2785):MainThread @libvirtd.py:_listDomains:238 - Libvirt domains found: cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede
2015-12-30 17:54:23,502 [virtwho.env_cmdline DEBUG] Libvirtd-1(2785):MainThread @virt.py:enqueue:331 - Report gathered, putting to queue for sending
2015-12-30 17:54:23,505 [virtwho.main DEBUG] MainProcess(2777):MainThread @virtwho.py:update_report_to_send:274 - Report for config "env/cmdline" updated
2015-12-30 17:54:23,511 [virtwho.main DEBUG] MainProcess(2777):MainThread @subscriptionmanager.py:_connect:112 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-12-30 17:54:23,737 [virtwho.main DEBUG] MainProcess(2777):MainThread @subscriptionmanager.py:hypervisorCheckIn:149 - Checking if server has capability 'hypervisor_async'
2015-12-30 17:54:23,947 [virtwho.main DEBUG] MainProcess(2777):MainThread @subscriptionmanager.py:hypervisorCheckIn:161 - Server does not have 'hypervisors_async' capability
2015-12-30 17:54:23,947 [virtwho.main INFO] MainProcess(2777):MainThread @subscriptionmanager.py:hypervisorCheckIn:170 - Sending update in hosts-to-guests mapping: 1 hypervisors and 1 guests found
2015-12-30 17:54:23,948 [virtwho.main DEBUG] MainProcess(2777):MainThread @subscriptionmanager.py:hypervisorCheckIn:171 - Host-to-guest mapping: {
    "80804c56-82fb-e111-a260-b4b52fcb471e": [
        {
            "guestId": "cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede", 
            "state": 3, 
            "attributes": {
                "active": 1, 
                "hypervisorVersion": "0.12.1", 
                "virtWhoType": "libvirt", 
                "hypervisorType": "QEMU"
            }
        }
    ]
}
2015-12-30 17:54:24,236 [virtwho.main DEBUG] MainProcess(2777):MainThread @virtwho.py:send_current_report:206 - Report for config "env/cmdline" sent

4. make sure no any host/guest changes in 60s, and then check the rhsm.log



Actual results:
virt-who show nothing after 60s


Expected results:
virt-who should show some info after 60s, such as:
"No change in report gathered using config: "env/cmdline", report not sent."


Additional info:

Comment 2 Radek Novacek 2016-02-11 09:27:57 UTC
virt-who in libvirt mode doesn't check for changes every 60 seconds. It listens to events provided by libvirt instead. So it shouldn't write that nothing was changed into the logfile. It only writes something when some change occurs. It this acceptable?

Comment 3 Eko 2016-02-17 06:17:25 UTC
OK, I will update our test case for libvirt mode, so close this bug as NOTABUG.

Comment 4 Eko 2016-02-26 07:06:13 UTC
as discussion, virt-who should check for changes each `interval` second no matter if it's listening for events, to keep the test consistency.
that means libvirt and kvm will show the "Waiting" info according to the interval value when no trigger event occurs, so reopen this issue.

Comment 5 Radek Novacek 2016-03-08 09:55:15 UTC
This should be already fixed in virt-who-0.16-6.el6.

Comment 6 Liushihui 2016-03-11 07:51:54 UTC
In the latest virt-who-0.16-6.el6.noarch, virt-who send mapping info to server per 60s when no host/guests updates for libvirt mode. Please see the detail as the following:

2016-03-11 02:38:39,389 [virtwho.init INFO] MainProcess(3193):MainThread @virtwho.py:parseOptions:637 - Using reporter_id='ibm-x3250m4-07.rhts.eng.bos.redhat.com'
2016-03-11 02:38:39,391 [virtwho.init INFO] MainProcess(3193):MainThread @virtwho.py:main:722 - No configurations found, using libvirt as backend
2016-03-11 02:38:39,391 [virtwho.init INFO] MainProcess(3193):MainThread @virtwho.py:main:729 - Using configuration "env/cmdline" ("libvirt" mode)
2016-03-11 02:38:39,410 [virtwho.main DEBUG] MainProcess(3195):MainThread @virtwho.py:run:231 - Starting infinite loop with 60 seconds interval
2016-03-11 02:38:39,544 [virtwho.env_cmdline DEBUG] Libvirtd-1(3203):MainThread @virt.py:run:358 - Virt backend 'env/cmdline' started
2016-03-11 02:38:39,545 [virtwho.env_cmdline INFO] Libvirtd-1(3203):MainThread @libvirtd.py:_connect:156 - Using libvirt url: ""
2016-03-11 02:38:39,575 [virtwho.env_cmdline DEBUG] Libvirtd-1(3203):MainThread @libvirtd.py:_listDomains:244 - Libvirt domains found: d06af74a-2372-6554-d465-a8474fda6e00
2016-03-11 02:38:39,575 [virtwho.env_cmdline DEBUG] Libvirtd-1(3203):MainThread @virt.py:enqueue:351 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-03-11 02:38:39,599 [virtwho.main DEBUG] MainProcess(3195):MainThread @subscriptionmanager.py:_connect:121 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-03-11 02:38:39,745 [virtwho.main INFO] MainProcess(3195):MainThread @subscriptionmanager.py:sendVirtGuests:147 - Sending update in guests lists for config "env/cmdline": 1 guests found
2016-03-11 02:38:39,745 [virtwho.main DEBUG] MainProcess(3195):MainThread @subscriptionmanager.py:sendVirtGuests:148 - Domain info: [
    {
        "guestId": "d06af74a-2372-6554-d465-a8474fda6e00", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "hypervisorVersion": "0.12.1", 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }
]
2016-03-11 02:38:41,377 [virtwho.main DEBUG] MainProcess(3195):MainThread @virtwho.py:send_report:161 - Report for config "env/cmdline" sent

===============Send mapping info after the first 60s================
2016-03-11 02:39:39,648 [virtwho.env_cmdline DEBUG] Libvirtd-1(3203):MainThread @libvirtd.py:_listDomains:244 - Libvirt domains found: d06af74a-2372-6554-d465-a8474fda6e00
2016-03-11 02:39:39,648 [virtwho.env_cmdline DEBUG] Libvirtd-1(3203):MainThread @virt.py:enqueue:351 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-03-11 02:39:41,381 [virtwho.main DEBUG] MainProcess(3195):MainThread @subscriptionmanager.py:_connect:121 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-03-11 02:39:41,534 [virtwho.main INFO] MainProcess(3195):MainThread @subscriptionmanager.py:sendVirtGuests:147 - Sending update in guests lists for config "env/cmdline": 1 guests found
2016-03-11 02:39:41,534 [virtwho.main DEBUG] MainProcess(3195):MainThread @subscriptionmanager.py:sendVirtGuests:148 - Domain info: [
    {
        "guestId": "d06af74a-2372-6554-d465-a8474fda6e00", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "hypervisorVersion": "0.12.1", 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }
]
2016-03-11 02:39:43,110 [virtwho.main DEBUG] MainProcess(3195):MainThread @virtwho.py:send_report:161 - Report for config "env/cmdline" sent

===============Send mapping info after the second 60s================
2016-03-11 02:40:39,720 [virtwho.env_cmdline DEBUG] Libvirtd-1(3203):MainThread @libvirtd.py:_listDomains:244 - Libvirt domains found: d06af74a-2372-6554-d465-a8474fda6e00
2016-03-11 02:40:39,721 [virtwho.env_cmdline DEBUG] Libvirtd-1(3203):MainThread @virt.py:enqueue:351 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-03-11 02:40:43,119 [virtwho.main DEBUG] MainProcess(3195):MainThread @subscriptionmanager.py:_connect:121 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-03-11 02:40:43,264 [virtwho.main INFO] MainProcess(3195):MainThread @subscriptionmanager.py:sendVirtGuests:147 - Sending update in guests lists for config "env/cmdline": 1 guests found
2016-03-11 02:40:43,264 [virtwho.main DEBUG] MainProcess(3195):MainThread @subscriptionmanager.py:sendVirtGuests:148 - Domain info: [
    {
        "guestId": "d06af74a-2372-6554-d465-a8474fda6e00", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "hypervisorVersion": "0.12.1", 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }
]

Comment 7 Radek Novacek 2016-03-15 14:33:03 UTC
Right, it doesn't work in local libvirt mode. I have fixed it upstream [1]. But I don't think it's necessary to fix it in RHEL-6.8, we'll fix it in 6.9.


Let's focus on remote hypervisors for now.


[1] https://github.com/virt-who/virt-who/commit/79e528d81e42484a3041fec60b45f23f3ef43312

Comment 9 Liushihui 2016-03-24 06:18:38 UTC
Verified it on virt-who-0.16-7.el6 since virt-who will show notice info if no update in host/guest mapping when virt-who work at remote libvirt mode. Therefore,verify it.

The log info as the following:
2016-03-24 02:15:26,458 [virtwho.env_cmdline INFO] Libvirtd-1(3676):MainThread @libvirtd.py:_connect:156 - Using libvirt url: qemu+ssh://root.eng.bos.redhat.com/system?no_tty=1
2016-03-24 02:15:27,268 [virtwho.env_cmdline DEBUG] Libvirtd-1(3676):MainThread @libvirtd.py:_listDomains:244 - Libvirt domains found: 9bc436d8-20cf-711c-4056-d30f8c709a0f
2016-03-24 02:15:27,270 [virtwho.env_cmdline DEBUG] Libvirtd-1(3676):MainThread @virt.py:enqueue:351 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-03-24 02:15:27,311 [virtwho.main DEBUG] MainProcess(3668):MainThread @subscriptionmanager.py:_connect:121 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-03-24 02:15:27,849 [virtwho.main DEBUG] MainProcess(3668):MainThread @subscriptionmanager.py:hypervisorCheckIn:162 - Checking if server has capability 'hypervisor_async'
2016-03-24 02:15:28,636 [virtwho.main DEBUG] MainProcess(3668):MainThread @subscriptionmanager.py:hypervisorCheckIn:174 - Server does not have 'hypervisors_async' capability
2016-03-24 02:15:28,637 [virtwho.main INFO] MainProcess(3668):MainThread @subscriptionmanager.py:hypervisorCheckIn:185 - Sending update in hosts-to-guests mapping for config "env/cmdline": 1 hypervisors and 1 guests found
2016-03-24 02:15:28,638 [virtwho.main DEBUG] MainProcess(3668):MainThread @subscriptionmanager.py:hypervisorCheckIn:186 - Host-to-guest mapping: {
    "44454c4c-0000-1020-8020-80c04f202020": [
        {
            "guestId": "9bc436d8-20cf-711c-4056-d30f8c709a0f", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "hypervisorVersion": "0.12.1", 
                "virtWhoType": "libvirt", 
                "hypervisorType": "QEMU"
            }
        }
    ]
}
2016-03-24 02:15:29,316 [virtwho.main DEBUG] MainProcess(3668):MainThread @virtwho.py:send_report:161 - Report for config "env/cmdline" sent


2016-03-24 02:16:27,345 [virtwho.env_cmdline DEBUG] Libvirtd-1(3676):MainThread @libvirtd.py:_listDomains:244 - Libvirt domains found: 9bc436d8-20cf-711c-4056-d30f8c709a0f
2016-03-24 02:16:27,346 [virtwho.env_cmdline DEBUG] Libvirtd-1(3676):MainThread @virt.py:enqueue:351 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-03-24 02:16:27,349 [virtwho.main INFO] MainProcess(3668):MainThread @virtwho.py:run:309 - Report for config "env/cmdline" hasn't changed, not sending
2016-03-24 02:17:27,421 [virtwho.env_cmdline DEBUG] Libvirtd-1(3676):MainThread @libvirtd.py:_listDomains:244 - Libvirt domains found: 9bc436d8-20cf-711c-4056-d30f8c709a0f
2016-03-24 02:17:27,422 [virtwho.env_cmdline DEBUG] Libvirtd-1(3676):MainThread @virt.py:enqueue:351 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-03-24 02:17:27,424 [virtwho.main INFO] MainProcess(3668):MainThread @virtwho.py:run:309 - Report for config "env/cmdline" hasn't changed, not sending

Comment 11 errata-xmlrpc 2016-05-10 23:57:08 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/RHEA-2016-0859.html