Bug 1254840

Summary: virt-who filter_host_uuids or exclude_host_uuids can't support single quotes
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-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:57:51 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-19 02:40:23 UTC
Description of problem:
The following two modes can't be supported:
 1). use '' for uuids
 filter_host_uuids='aee4ff00-8c33-11e2-994a-6c3be51d959a' 
 2). there is a space between uuids  ", "
 filter_host_uuids="aee4ff00-8c33-11e2-994a-6c3be51d959a", "b081ac44-e247-2c82-4fea-825c08228288"

Version-Release number of selected component (if applicable):
 - RHEL7.2-20150806.1-Server + ESXi6.0 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. create config file, use single quotes for 'uuids'
[test-esx]
type=esx
server=10.66.78.89
username=administrator
password=qwer1234P!
owner=7652501
env=7652501
filter_host_uuids='aee4ff00-8c33-11e2-994a-6c3be51d959a' 

3. restart virt-who service and check the rhsm.log
2015-08-19 10:29:35,545 [DEBUG]  @virtwho.py:126 - Using config named 'test-esx'
2015-08-19 10:29:35,545 [INFO]  @virtwho.py:662 - Using configuration "test-esx" ("esx" mode)
2015-08-19 10:29:35,546 [DEBUG]  @virtwho.py:209 - Starting infinite loop with 10 seconds interval
2015-08-19 10:29:35,575 [DEBUG]  @esx.py:55 - Log into ESX
2015-08-19 10:29:35,788 [DEBUG]  @esx.py:58 - Creating ESX event filter
2015-08-19 10:29:35,867 [DEBUG]  @esx.py:142 - Waiting for ESX changes
2015-08-19 10:29:35,870 [DEBUG]  @virt.py:173 - Skipping host 'b081ac44-e247-2c82-4fea-825c08228288' because its uuid is not included

======== aee4ff00-8c33-11e2-994a-6c3be51d959a still be skipped ========
2015-08-19 10:29:35,870 [DEBUG]  @virt.py:173 - Skipping host 'aee4ff00-8c33-11e2-994a-6c3be51d959a' because its uuid is not included
2015-08-19 10:29:35,871 [DEBUG]  @subscriptionmanager.py:112 - Authenticating with certificate: /etc/pki/consumer/cert.pem

4. update the config file, make sure there is a blank space between uuids 
[test-esx]
type=esx
server=10.66.78.89
username=administrator
password=qwer1234P!
owner=7652501
env=7652501
filter_host_uuids="aee4ff00-8c33-11e2-994a-6c3be51d959a", "b081ac44-e247-2c82-4fea-825c08228288"

5. restart virt-who service and check the rhsm.log
2015-08-19 10:34:09,298 [DEBUG]  @virtwho.py:126 - Using config named 'test-esx'
2015-08-19 10:34:09,298 [INFO]  @virtwho.py:662 - Using configuration "test-esx" ("esx" mode)
2015-08-19 10:34:09,298 [DEBUG]  @virtwho.py:209 - Starting infinite loop with 10 seconds interval
2015-08-19 10:34:09,327 [DEBUG]  @esx.py:55 - Log into ESX
2015-08-19 10:34:09,513 [DEBUG]  @esx.py:58 - Creating ESX event filter
2015-08-19 10:34:09,581 [DEBUG]  @esx.py:142 - Waiting for ESX changes

======== b081ac44-e247-2c82-4fea-825c08228288 will be skipped =========
2015-08-19 10:34:09,586 [DEBUG]  @virt.py:173 - Skipping host 'b081ac44-e247-2c82-4fea-825c08228288' because its uuid is not included
2015-08-19 10:34:09,586 [DEBUG]  @subscriptionmanager.py:112 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-08-19 10:34:12,581 [DEBUG]  @subscriptionmanager.py:146 - Checking if server has capability 'hypervisor_async'
2015-08-19 10:34:15,043 [DEBUG]  @subscriptionmanager.py:158 - Server does not have 'hypervisors_async' capability
2015-08-19 10:34:15,043 [INFO]  @subscriptionmanager.py:165 - Sending update in hosts-to-guests mapping: {
    "aee4ff00-8c33-11e2-994a-6c3be51d959a": [
        {
            "guestId": "564d3964-c083-deba-55f9-000279dd82f9", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "virtWhoType": "esx"
            }
        }
    ]
}
2015-08-19 10:34:19,604 [DEBUG]  @esx.py:142 - Waiting for ESX changes


Actual results:
1). can't be use '' for uuids
2). if there is a blank space between uuids, the uuid behind blank space is invalid.


Expected results:
1). the uuids should be split by ''
2). even there is a blank space between uuids, filter_host_uuids or exclude_host_uuids still can work

Additional info:

Comment 2 Eko 2015-08-19 05:16:28 UTC
not only filter_host_uuids and exclude_host_uuids,
filter_host_parents and exclude_host_parents have the same problem.

Comment 3 Radek Novacek 2015-08-25 17:11:34 UTC
Fixed in virt-who-0.14-5.el7.

Comment 5 Eko 2015-09-08 06:07:29 UTC
verified in virt-who-0.14-7.el7.noarch, this issue can't be duplicated.

Comment 6 errata-xmlrpc 2015-11-19 11:57:51 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