Bug 1253533

Summary: virt-who still can be executed at background with -b option, but no -b or VIRTWHO_BACKGROUND any more
Product: Red Hat Enterprise Linux 7 Reporter: Eko <hsun>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: xingge <gxing>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: dazhang, gxing, ldai, ovasik, sgao, shihliu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.14-4.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:57: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 Eko 2015-08-14 03:03:56 UTC
Description of problem:
virt-who-0.14-3.el7.noarch removed the -b and VIRTWHO_BACKGROUND already, but if I run "virt-who -b", still can make virt-who running in background. 

Version-Release number of selected component (if applicable):
 - RHEL7.2-20150806.1-Server-x86_64(KVM) against stage candlepin
 - virt-who-0.14-3.el7.noarch
 - subscription-manager-1.15.9-2.el7.x86_64
 - python-rhsm-1.15.4-2.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. stop virt-who service

2. check virt-who option, no -b option found
# virt-who --help
Usage: virt-who [-d] [-i INTERVAL] [-o] [--sam|--satellite5|--satellite6] [--libvirt|--vdsm|--esx|--rhevm|--hyperv]

Agent for reporting virtual guest IDs to subscription manager

Options:
  -h, --help            show this help message and exit
  -d, --debug           Enable debugging output
  -o, --one-shot        Send the list of guest IDs and exit immediately
  -i INTERVAL, --interval=INTERVAL
                        Acquire and send list of virtual guest each N seconds
  -p, --print           Print the host/guest association obtained from
                        virtualization backend (implies oneshot)
  -c CONFIGS, --config=CONFIGS
                        Configuration file that will be processed, can be used

3. run virt-who with -b option
# virt-who -d -b -i 3

4. check virt-who PID
# ps -ef|grep virt-who
root     26983     1  0 10:39 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py -d -b -i 3
root     26984 26983  0 10:39 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py -d -b -i 3

5. check rhsm.log
2015-08-14 10:41:32,637 [INFO]  @subscriptionmanager.py:136 - Sending domain info: [
    {
        "guestId": "04d4c7ba-4fd3-432c-b59a-91e72e7edff8", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }, 
    {
        "guestId": "5262e779-29c6-4331-a344-c46e78012425", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }, 
    {
        "guestId": "95572a0b-390a-4364-ae96-a48c5134d47d", 
        "state": 1, 
        "attributes": {
            "active": 1, 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }
]
2015-08-14 10:41:34,324 [DEBUG]  @libvirtd.py:210 - Virtual machine found: rhel7.0: 95572a0b-390a-4364-ae96-a48c5134d47d
2015-08-14 10:41:34,325 [DEBUG]  @libvirtd.py:216 - Virtual machine found: rhel7.0-backup: 5262e779-29c6-4331-a344-c46e78012425
2015-08-14 10:41:34,325 [DEBUG]  @libvirtd.py:216 - Virtual machine found: rhel7.0-clone-test: 04d4c7ba-4fd3-432c-b59a-91e72e7edff8
2015-08-14 10:41:34,325 [DEBUG]  @libvirtd.py:220 - Libvirt domains found: ['95572a0b-390a-4364-ae96-a48c5134d47d', '5262e779-29c6-4331-a344-c46e78012425', '04d4c7ba-4fd3-432c-b59a-91e72e7edff8']
2015-08-14 10:41:36,377 [INFO]  @virtwho.py:190 - virt-who guest list update successful


Actual results:
no -b or VIRTWHO_BACKGROUND for virt-who, but virt-who still can be executed with -b option

Expected results:
if the -b or VIRTWHO_BACKGROUND is not available, virt-who shouldn't be executed with -b

Additional info:

Comment 2 Radek Novacek 2015-08-18 15:57:18 UTC
Fixed in virt-who-0.14-4.el7.

Comment 4 Liushihui 2015-08-25 07:52:00 UTC
Verified it on virt-who-0.14-4.el7 since all -b related function has been removed

Verified version
virt-who-0.14-4.el7.noarch
subscription-manager-1.15.9-6.el7.x86_64
python-rhsm-1.15.4-2.el7.x86_64
SAM-1.4.1-RHEL-6-20141113.0

Verified process:
1. Register system to SAM
2. Stop virt-who service.
3. Run virt-who with -b, it will show error info
[root@ibm-hs22-01 ~]# systemctl stop virt-who
[root@ibm-hs22-01 ~]# virt-who -b -d 
Usage: virt-who [-d] [-i INTERVAL] [-o] [--sam|--satellite5|--satellite6] [--libvirt|--vdsm|--esx|--rhevm|--hyperv]

virtwho.py: error: no such option: -b
[root@ibm-hs22-01 ~]# ps -ef|grep virt-who
root      9305  8546  0 09:48 pts/0    00:00:00 grep --color=auto virt-who


Result:
-b option has been removed, it can't run virt-who with -b option

Comment 5 errata-xmlrpc 2015-11-19 11:57:49 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/RHBA-2015-2370.html