Bug 1295262

Summary: VIRTWHO_INTERVAL or -i option value is invalid, always loop with 60 seconds by default
Product: Red Hat Enterprise Linux 6 Reporter: Eko <hsun>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED NOTABUG QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8CC: ovasik, rbalakri, sgao, shihliu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-07 07:22:50 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 2016-01-04 03:13:38 UTC
Description of problem:
set VIRTWHO_INTERVAL to 5 and then restart virt-who service, virt-who still start infinite loop with 60 seconds interval, not 5s.

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

How reproducible:
always

Steps to Reproduce:
1. set VIRTWHO_INTERVAL to 5 in /etc/sysconfig/virt-who
VIRTWHO_INTERVAL=5

2. restart virt-who service
# /etc/init.d/virt-who restart

3. check /var/log/rhsm/rhsm.log
2016-01-04 10:55:59,426 [virtwho.init INFO] MainProcess(31087):MainThread @virtwho.py:parseOptions:720 - Using reporter_id='hp-z220-09.qe.lab.eng.nay.redhat.com'
2016-01-04 10:55:59,429 [virtwho.init WARNING] MainProcess(31087):MainThread @config.py:checkOptions:255 - Password authentication doesn't work with ssh transport on libvirt backend, copy your public ssh key to the remote machine
2016-01-04 10:55:59,429 [virtwho.init INFO] MainProcess(31087):MainThread @virtwho.py:main:811 - Using configuration "env/cmdline" ("libvirt" mode)

=============== Starting infinite loop with 60 seconds interval =============

2016-01-04 10:55:59,443 [virtwho.main DEBUG] MainProcess(31089):MainThread 
@virtwho.py:run:287 - Starting infinite loop with 60 seconds interval
2016-01-04 10:55:59,550 [virtwho.env_cmdline DEBUG] Libvirtd-1(31097):MainThread @virt.py:run:338 - Virt backend 'env/cmdline' started
2016-01-04 10:55:59,551 [virtwho.env_cmdline INFO] Libvirtd-1(31097):MainThread @libvirtd.py:_get_url:124 - Protocol is not specified in libvirt url, using qemu+ssh://
2016-01-04 10:55:59,551 [virtwho.env_cmdline INFO] Libvirtd-1(31097):MainThread @libvirtd.py:_get_url:135 - Libvirt path is not specified in the url, using /system
2016-01-04 10:55:59,551 [virtwho.env_cmdline INFO] Libvirtd-1(31097):MainThread @libvirtd.py:_connect:156 - Using libvirt url: qemu+ssh://root.144.8/system?no_tty=1
2016-01-04 10:55:59,914 [virtwho.env_cmdline DEBUG] Libvirtd-1(31097):MainThread @libvirtd.py:_listDomains:228 - Virtual machine found: rhel7.2: cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede
2016-01-04 10:55:59,915 [virtwho.env_cmdline DEBUG] Libvirtd-1(31097):MainThread @libvirtd.py:_listDomains:238 - Libvirt domains found: cb33ddce-fd1e-0e6a-7e7f-d3c6fca67ede
2016-01-04 10:55:59,915 [virtwho.env_cmdline DEBUG] Libvirtd-1(31097):MainThread @virt.py:enqueue:331 - Report gathered, putting to queue for sending
2016-01-04 10:55:59,918 [virtwho.main DEBUG] MainProcess(31089):MainThread @virtwho.py:update_report_to_send:274 - Report for config "env/cmdline" updated
2016-01-04 10:55:59,924 [virtwho.main DEBUG] MainProcess(31089):MainThread @subscriptionmanager.py:_connect:112 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-01-04 10:56:00,142 [virtwho.main DEBUG] MainProcess(31089):MainThread @subscriptionmanager.py:hypervisorCheckIn:149 - Checking if server has capability 'hypervisor_async'
2016-01-04 10:56:00,349 [virtwho.main DEBUG] MainProcess(31089):MainThread @subscriptionmanager.py:hypervisorCheckIn:161 - Server does not have 'hypervisors_async' capability
2016-01-04 10:56:00,349 [virtwho.main INFO] MainProcess(31089):MainThread @subscriptionmanager.py:hypervisorCheckIn:170 - Sending update in hosts-to-guests mapping: 1 hypervisors and 1 guests found
2016-01-04 10:56:00,349 [virtwho.main DEBUG] MainProcess(31089):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"
            }
        }
    ]
}
2016-01-04 10:56:00,897 [virtwho.main DEBUG] MainProcess(31089):MainThread @virtwho.py:send_current_report:206 - Report for config "env/cmdline" sent



Actual results:
virt-who still loop with 60 seconds interval, not 5 seconds as I set.
it seems VIRTWHO_INTERVAL or -i option is not necessary, virt-who will always loop with 60s. 

Expected results:

Additional info:

Comment 2 Eko 2016-01-04 03:57:08 UTC
According to the new interval strategy, maybe virt-who will fetch the mapping info from hypervisor according to the different interval option value;

but virt-who will update the mapping info to sam/satellite/stage server always by default 60s;

of course, if the mapping info has some updates, such as add/delete/pause/poweroff/poweron guest, virt-who will be triggered by auto and send the latest mapping info to server;

so the question is how to check the interval option work or not? 
it seems the interval option is not necessary now.

Comment 3 Eko 2016-01-07 07:22:50 UTC
1). if interval < 60s
    will check the host/guests mapping info each 60s by auto 
        if no changes, don't send the mapping info to sam/satellite/stage
        if changes, will send the mapping info to sam/satellite/stage

    will be triggered if host/guests mapping info has updates for KVM and ESXI

2). if interval > 60s (N)
    will check the host/guests mapping info each N seconds loops by auto 
        if no changes, don't send the mapping info to sam/satellite/stage
        if changes, will send the mapping info to sam/satellite/stage

    will be triggered if host/guests mapping info has updates for KVM and ESXI