Bug 1257396

Summary: virt-who still send H/G mapping info to server although is_hypervisor is wrong
Product: Red Hat Enterprise Linux 7 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: xingge <gxing>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: gxing, hsun, ldai, ovasik, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.14-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:57:58 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 Liushihui 2015-08-27 02:26:09 UTC
Description of problem:
Although the fake data are fetched from multihost environment when virt-who run at offline mode, setting is_hypervisor=False(wrong config), virt-who still send wrong host/guest mapping info to server rather than send error info in the log.

Version-Release number of selected component (if applicable):
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
Satellite6.1.0-20150818.1

How reproducible:
Always

Steps to Reproduce:
1. Register system to satellite
2. Generate fake data which are fetched from multihost environment and save it to /root/fake:
# cat /root/fake
{"hypervisors": [{"uuid": "88d979a3-34f8-4cca-84e8-df0988257ba6", "guests": []}, {"uuid": "2c014415-c274-40f4-8265-b99c83d3e1aa", "guests": [{"guestId": "754215b3-e01e-420f-b7a8-e0cd2972c624", "state": 1, "attributes": {"active": 1, "virtWhoType": "rhevm", "hypervisorType": "qemu"}}, {"guestId": "4f1f93b8-c4c5-424d-89d8-1822367d2274", "state": 1, "attributes": {"active": 1, "virtWhoType": "rhevm", "hypervisorType": "qemu"}}]}]}
3. Run virt-who at offline mode and set is_hypervisor=False
# cat /etc/virt-who.d/fake
[fake-virt]
type=fake
file=/root/fake
is_hypervisor=False
owner=ACME_Corporation
env=Library
4.Restart virt-who service and check virt-who's log
# tail -f /var/log/rhsm/rhsm.log
2015-08-26 17:19:02,016 [DEBUG]  @virtwho.py:126 - Using config named 'fake-virt'
2015-08-26 17:19:02,017 [INFO]  @virtwho.py:661 - Using configuration "fake-virt" ("fake" mode)
2015-08-26 17:19:02,017 [DEBUG]  @virtwho.py:209 - Starting infinite loop with 3600 seconds interval
2015-08-26 17:19:02,050 [DEBUG]  @subscriptionmanager.py:112 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-08-26 17:19:05,623 [INFO]  @subscriptionmanager.py:136 - Sending domain info: [] 

Actual results:
virt-who send wrong mapping info to server,it just fetched guest info from the first host 

Expected results:
Since fake data are fetched from multihost environment which is not suit to is_hypervisor = False, Virt-who shouldn't send the wrong mapping info to satellite, it should show error info in the log:
" Virt backend 'fake-virt' fails with error: Fake virt file '/root/fake' is not properly formed: 'uuid' "

Additional info:
When fake data are fetched from singal host environment, setting is_hypervisor=True(Wrong config), virt-who won't send host/guest mapping to server but show error info as the following:
" Virt backend 'fake-virt' fails with error: Fake virt file '/root/fake' is not properly formed: 'uuid' "

Comment 1 Radek Novacek 2015-08-27 14:55:11 UTC
Fixed in virt-who-0.14-6.el7.

Comment 3 Liushihui 2015-09-06 03:06:55 UTC
Verified it on virt-who-0.14-7.el7.noarch since virt-who won't send h/g mapping to satellite when is_hypervisor is wrong. Therefore, verify it.

Verified version:
virt-who-0.14-7.el7.noarch
subscription-manager-1.15.9-7.el7.x86_64
python-rhsm-1.15.4-4.el7.x86_64

Verified process:
1. Register system to satellite
2. Generate fake data which are fetched from multihost environment and save it to /root/fake:
# cat /root/fake
{"hypervisors": [{"uuid": "88d979a3-34f8-4cca-84e8-df0988257ba6", "guests": []}, {"uuid": "2c014415-c274-40f4-8265-b99c83d3e1aa", "guests": [{"guestId": "754215b3-e01e-420f-b7a8-e0cd2972c624", "state": 1, "attributes": {"active": 1, "virtWhoType": "rhevm", "hypervisorType": "qemu"}}, {"guestId": "4f1f93b8-c4c5-424d-89d8-1822367d2274", "state": 1, "attributes": {"active": 1, "virtWhoType": "rhevm", "hypervisorType": "qemu"}}]}]}
3. Run virt-who at offline mode and set is_hypervisor=False
# cat /etc/virt-who.d/fake
[fake-virt]
type=fake
file=/root/fake
is_hypervisor=False
owner=ACME_Corporation
env=Library
4.Restart virt-who service and check virt-who's log
# tail -f /var/log/rhsm/rhsm.log
2015-09-06 11:03:06,388 [DEBUG]  @virtwho.py:132 - Using config named 'fake-virt'
2015-09-06 11:03:06,389 [INFO]  @virtwho.py:696 - Using configuration "fake-virt" ("fake" mode)
2015-09-06 11:03:06,389 [DEBUG]  @virtwho.py:215 - Starting infinite loop with 3600 seconds interval
2015-09-06 11:03:06,424 [ERROR]  @virt.py:303 - Virt backend 'fake-virt' fails with error: Fake virt file '/root/fake' is not properly formed: uuid key shouldn't be present, try to check is_hypervisor value

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