Bug 1318915

Summary: Virt-who can't filter/exclude uuid if there is a blank behind uuid
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8CC: ldai, rbalakri, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.18-1.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:29:31 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:

Description Liushihui 2016-03-18 06:17:20 UTC
Description of problem:
If there is a blank after uuid and before comma when set filter_host_uuids or  exlude_host_uuid, virt-who can't recognize that uuid . 
eg:
filter_host_uuids="77ea4d56-2176-2518-74f6-d350749401dd" ,"86b2bd00-8bad-11e2-87f4-6c3be514699d"
exclude_host_uuids="77ea4d56-2176-2518-74f6-d350749401dd" ,"86b2bd00-8bad-11e2-87f4-6c3be514699d"

Version-Release number of selected component (if applicable):
virt-who-0.16-7.el6.noarch
subscription-manager-1.16.8-5.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Register system to stage canlepin.
2. Configure virt-who run at esx mode in /etc/virt-who.d/esx, setting to filter two host's uuid, make sure there is a blank before the comma which separate these two uuids
[root@ibm-x3250m4-16 virt-who.d]# cat /etc/virt-who.d/esx 
[test-esx1]
type=esx
server=10.73.2.95
username=Administrator
encrypted_password=d7e94e75ce18ef1be41f86a3dc017b0f
owner=7715246
env=7715246
filter_host_uuids="77ea4d56-2176-2518-74f6-d350749401dd" ,"86b2bd00-8bad-11e2-87f4-6c3be514699d"
3. Restart virt-who and check virt-who's log
[root@ibm-x3250m4-16 virt-who.d]# service virt-who restart && tail -f /var/log/rhsm/rhsm.log 
Stopping virt-who:                                         [FAILED]
Starting virt-who:                                         [  OK  ]
.......................
2016-03-18 02:09:07,164 [virtwho.main DEBUG] MainProcess(28285):MainThread @subscriptionmanager.py:hypervisorCheckIn:162 - Checking if server has capability 'hypervisor_async'
2016-03-18 02:09:07,704 [virtwho.main DEBUG] MainProcess(28285):MainThread @subscriptionmanager.py:hypervisorCheckIn:174 - Server does not have 'hypervisors_async' capability
2016-03-18 02:09:07,704 [virtwho.main INFO] MainProcess(28285):MainThread @subscriptionmanager.py:hypervisorCheckIn:185 - Sending update in hosts-to-guests mapping for config "test-esx1": 1 hypervisors and 1 guests found
2016-03-18 02:09:07,704 [virtwho.main DEBUG] MainProcess(28285):MainThread 

======== 77ea4d56-2176-2518-74f6-d350749401dd has been skipped =========
@subscriptionmanager.py:hypervisorCheckIn:186 - Host-to-guest mapping: {
    "86b2bd00-8bad-11e2-87f4-6c3be514699d": [
        {
            "guestId": "420660d6-13f5-23bf-808b-161498bf1702", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "hypervisorVersion": "6.0.0", 
                "virtWhoType": "esx", 
                "hypervisorType": "VMware ESXi"
            }
        }
    ]
}
2016-03-18 02:09:08,469 [virtwho.main DEBUG] MainProcess(28285):MainThread @virtwho.py:send_report:161 - Report for config "test-esx1" sent

Actual results:
If there is a blank space between uuids, the uuid before blank space is invalid.

Expected results:
In filter_host_uuids or exclude_host_uuids, no matter blank before or behind uuid, the uuid should work.

Additional info:

Comment 3 Radek Novacek 2016-10-11 14:03:01 UTC
Fixed in virt-who-0.18-1.el6.

Comment 5 Eko 2016-12-06 06:19:34 UTC
verified in virt-who-0.18-1.el6

[test-xen]
type=xen
server=10.73.5.210
username=root
password=red2017
owner=8046180
env=8046180
filter_hosts="d4a794b5-e159-47eb-9b3e-12e666ce2b0e" , c75a0a65-1045-4f4a-987f-15fcd455533e

rhsm.log as expected:
2016-12-06 01:18:57,528 [virtwho.main DEBUG] MainProcess(4070):MainThread @subscriptionmanager.py:hypervisorCheckIn:196 - Host-to-guest mapping: {
    "d4a794b5-e159-47eb-9b3e-12e666ce2b0e": [
        {
            "guestId": "c092460f-9e1c-b713-fb30-3fb142430836", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "virtWhoType": "xen"
            }
        }
    ], 
    "c75a0a65-1045-4f4a-987f-15fcd455533e": []
}

Comment 7 errata-xmlrpc 2017-03-21 10:29:31 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-2017-0675.html