Bug 848777

Summary: virt-who creates background loop even if it's not running in background mode
Product: Red Hat Enterprise Linux 5 Reporter: Hui Wang <huiwang>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.9CC: khong, ovasik
Target Milestone: beta   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-who-0.7-5.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 07:35:45 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:
Bug Depends On:    
Bug Blocks: 808061    

Description Hui Wang 2012-08-16 11:47:15 UTC
Description of problem:

Start virt-who service as "virt-who -d", if the virtual machines are added/deleted, virt-who can't report the current virt.uuids, only report the event.

Version-Release number of selected component (if applicable):
virt-who-0.7-2.el5
subscription-manager-firstboot-1.0.13-1.el5
subscription-manager-1.0.13-1.el5
subscription-manager-gui-1.0.13-1.el5
python-rhsm-1.0.5-1.el5
katello-headpin-all-0.2.13-1.el6_2.noarch
candlepin-0.6.5-1.el6_2.noarch

How reproducible:
100%

Steps to Reproduce:
1. Register Host to SAM server
2. Edit virt-who config file on Host: 
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
3. Start the virt-who service
# virt-who -d
DEBUG: Starting event loop
/usr/lib64/python2.4/site-packages/rhsm/certificate.py:123: DeprecationWarning: Call to deprecated function: __init__
  category=DeprecationWarning)
DEBUG: Virt-who is running in libvirt mode
DEBUG: Starting infinite loop with 3600 seconds interval
DEBUG: Virtual machine found: 5.8_Server_x86_64: 15cbe67a-50b0-f62f-33c5-5e332622964a
DEBUG: Sending list of uuids: ['15cbe67a-50b0-f62f-33c5-5e332622964a']
4. Add one virtual guest:
# virt-who -d
DEBUG: Starting event loop
/usr/lib64/python2.4/site-packages/rhsm/certificate.py:123: DeprecationWarning: Call to deprecated function: __init__
  category=DeprecationWarning)
DEBUG: Virt-who is running in libvirt mode
DEBUG: Starting infinite loop with 3600 seconds interval
DEBUG: Virtual machine found: 5.8_Server_x86_64: 15cbe67a-50b0-f62f-33c5-5e332622964a
DEBUG: Sending list of uuids: ['15cbe67a-50b0-f62f-33c5-5e332622964a']
DEBUG: EVENT: Domain test(7) Started Booted
DEBUG: EVENT: Domain test(7) Defined Updated
5. List the current virtual guests
virsh list --all
 Id Name                 State
----------------------------------
  6 5.8_Server_x86_64    running
  7 test                 running

6. Restart the virt-who, it will report the current virt.uuids
# virt-who -d
DEBUG: Starting event loop
/usr/lib64/python2.4/site-packages/rhsm/certificate.py:123: DeprecationWarning: Call to deprecated function: __init__
  category=DeprecationWarning)
DEBUG: Virt-who is running in libvirt mode
DEBUG: Starting infinite loop with 3600 seconds interval
DEBUG: Virtual machine found: 5.8_Server_x86_64: 15cbe67a-50b0-f62f-33c5-5e332622964a
DEBUG: Virtual machine found: test: d01d1b9f-6c30-ed74-f48b-dc1d126ae259
DEBUG: Sending list of uuids: ['15cbe67a-50b0-f62f-33c5-5e332622964a', 'd01d1b9f-6c30-ed74-f48b-dc1d126ae259']

Actual results:
virt-who -d can't report the virt.uuids immediately if add/delete virtual machines, only report the event.

Expected results:
virt-who -d can report the virt.uuids immediately if add/delete virtual machines.

Additional info:

Comment 1 RHEL Program Management 2012-08-16 11:57:17 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 2 Radek Novacek 2012-08-24 07:38:17 UTC
This is expected behaviour. Running virt-who from command line don't read /etc/sysconfig/virt-who - this file is used only when starting virt-who as a service. Therefore the VIRTWHO_BACKGROUND=1 option is not used and virt-who shouldn't create background loop.

But the background loop is created by mistake and the events are written to the log. I'll use this bug to fix this.

Comment 3 Radek Novacek 2012-08-24 10:00:34 UTC
This bug has been fixed in virt-who-0.7-4.el5.

Comment 5 Hui Wang 2012-08-29 08:38:49 UTC
The background loop will be stop when add one guest. Moving to ASSIGNED.

1. start virt-who via command line
[root@localhost ~]# virt-who -d
WARNING: Listening for events is not available in VDSM or ESX mode
DEBUG: Virt-who is running in libvirt mode
DEBUG: Starting infinite loop with 3600 seconds interval
DEBUG: Virtual machine found: test3: 03651aeb-0e9d-1ac5-c97e-fc0f478d9341
DEBUG: Virtual machine found: test2: 6b170a2c-5966-63e7-a970-c571bb45ff5a
DEBUG: Virtual machine found: rhel5.9server: fc584ab2-3f59-9423-aedf-346e15ce755e
DEBUG: Sending list of uuids: ['03651aeb-0e9d-1ac5-c97e-fc0f478d9341', '6b170a2c-5966-63e7-a970-c571bb45ff5a', 'fc584ab2-3f59-9423-aedf-346e15ce755e']
2. Add one guest
[root@localhost ~]# virt-who -d
WARNING: Listening for events is not available in VDSM or ESX mode
DEBUG: Virt-who is running in libvirt mode
DEBUG: Starting infinite loop with 3600 seconds interval
DEBUG: Virtual machine found: test3: 03651aeb-0e9d-1ac5-c97e-fc0f478d9341
DEBUG: Virtual machine found: test2: 6b170a2c-5966-63e7-a970-c571bb45ff5a
DEBUG: Virtual machine found: rhel5.9server: fc584ab2-3f59-9423-aedf-346e15ce755e
DEBUG: Sending list of uuids: ['03651aeb-0e9d-1ac5-c97e-fc0f478d9341', '6b170a2c-5966-63e7-a970-c571bb45ff5a', 'fc584ab2-3f59-9423-aedf-346e15ce755e']
Segmentation fault ^^^^^
[root@localhost ~]#

Comment 6 Radek Novacek 2012-09-03 11:01:21 UTC
This bug should be fixed in virt-who-0.7-5.el5.

Comment 7 Hui Wang 2012-09-05 09:16:49 UTC
Version:
        virt-who-0.7-5.el5
	libvirt-0.8.2-29.el5
	python-rhsm-1.0.6-1.el5
	subscription-manager-1.0.14-1.el5
	katello-headpin-all-0.2.13-1.el6_2.noarch
	candlepin-0.6.5-1.el6_2.noarch

# virt-who -d
WARNING: Listening for events is not available in VDSM or ESX mode
DEBUG: Virt-who is running in libvirt mode
DEBUG: Starting infinite loop with 3600 seconds interval
DEBUG: Virtual machine found: 5.8_Server_x86_64: 26bf6b1d-e6fc-29ed-3d8c-bb89f15f3e77
DEBUG: Sending list of uuids: ['26bf6b1d-e6fc-29ed-3d8c-bb89f15f3e77']
^^^^^^^^^^^No the "Segmentation fault"

But add/delete/migrate guests, the /var/log/rhsm/rhsm.log no updates. This issue can be tracked in: https://bugzilla.redhat.com/show_bug.cgi?id=848763

Comment 8 Hui Wang 2012-09-17 07:15:59 UTC
According comment7, moving the bug to VERIFIED.

Comment 10 errata-xmlrpc 2013-01-08 07:35:45 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.

http://rhn.redhat.com/errata/RHBA-2013-0072.html