Bug 1167451

Summary: virt-who using wrong username and password for Satellite login
Product: Red Hat Enterprise Linux 6 Reporter: Matthew LeSieur <matthew.lesieur>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: gaoshang <sgao>
Severity: low Docs Contact:
Priority: medium    
Version: 6.0CC: aathomas, cperry, ifloodmu, jherrman, ovasik, rbalakri, shihliu
Target Milestone: rc   
Target Release: ---   
Hardware: noarch   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.12-1.el6 Doc Type: Bug Fix
Doc Text:
Logging in to a Red Hat Satellite 5 server with the virt-who agent previously failed with an "incomplete format" error. With this update, virt-who uses correct credentials for connecting to Satellite 5 servers, and the login now works.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:15: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:
Embargoed:
Attachments:
Description Flags
Patch to fix file /usr/share/virt-who/manager/satellite/satellite.py none

Description Matthew LeSieur 2014-11-24 20:05:35 UTC
Created attachment 960912 [details]
Patch to fix file /usr/share/virt-who/manager/satellite/satellite.py

Description of problem:

When configuring virt-who to populate Red Hat Satellite with hypervisors and virtual machine information from a vCenter server, the username and password for vCenter is erroneously used to log into Red Hat Satellite.

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 6.6 (Santiago)
virt-who-0.10-8.el6.noarch

How reproducible:
Configure virt-who to source information from a vCenter server and target information to a Red Hat Satellite server.

Steps to Reproduce:
1. Configure virt-who by entering appropriate information into /etc/sysconfig/virt-who (see below).  Temporarily, enable DEBUG and disable BACKGROUND.
2. Start virt-who: service virt-who start
3. See error messages about Satellite login problem.

Actual results:
ERROR: Unable to send host/guest assocaition to the satellite:
Traceback (most recent call last):
  File "/usr/share/virt-who/manager/satellite/satellite.py", line 158, in hypervisorCheckIn
    self.server.registration.virt_notify(hypervisor_systemid["system_id"], plan)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1243, in request
    headers
ProtocolError: <ProtocolError for vcenter.example.com/XMLRPC: 400 Bad Request>
ERROR: Error in communication with subscription manager, trying to recover:
Traceback (most recent call last):
  File "/usr/share/virt-who/virtwho.py", line 125, in _send
    self._sendGuests(config, virtualGuests)
  File "/usr/share/virt-who/virtwho.py", line 154, in _sendGuests
    result = manager.hypervisorCheckIn(config, virtualGuests)
  File "/usr/share/virt-who/manager/satellite/satellite.py", line 161, in hypervisorCheckIn
    raise SatelliteError("Unable to send host/guest assocaition to the satellite: % " % str(e))
ValueError: incomplete format

Expected results:
  Virt-who should be using the VIRTWHO_SATELLITE* variables for logging into Satellite, not VIRTWHO_ESX*

Additional info:
  Problem resolved using the attached patch.

  Important parts of /etc/sysconfig/virt-who:

VIRTWHO_BACKGROUND=0
VIRTWHO_DEBUG=1
VIRTWHO_ONE_SHOT=1
VIRTWHO_INTERVAL=0
VIRTWHO_SAM=0
VIRTWHO_SATELLITE=1
VIRTWHO_LIBVIRT=0
VIRTWHO_VDSM=0
VIRTWHO_ESX=1
VIRTWHO_RHEVM=0
VIRTWHO_HYPERV=0
VIRTWHO_ESX_OWNER=“Company Name”
VIRTWHO_ESX_ENV=not-used
VIRTWHO_ESX_SERVER="vcenter.example.com”
VIRTWHO_ESX_USERNAME="rh-virt-who”
VIRTWHO_ESX_PASSWORD="eradicated"
VIRTWHO_SATELLITE_SERVER=rhnsat.example.com
VIRTWHO_SATELLITE_USERNAME=virtwho
VIRTWHO_SATELLITE_PASSWORD=“eradicated”

Comment 1 Radek Novacek 2014-11-25 10:54:34 UTC
The same bug appears on RHEL-7: https://bugzilla.redhat.com/show_bug.cgi?id=1158859

Comment 2 Radek Novacek 2014-11-26 12:45:12 UTC
*** Bug 1167943 has been marked as a duplicate of this bug. ***

Comment 3 Radek Novacek 2015-02-26 09:47:44 UTC
This bug has been addresses upstream and will be fixed by rebase in RHEL-6.7.

Comment 4 Radek Novacek 2015-02-27 19:37:19 UTC
Fixed by rebase to virt-who-0.12-1.el6.

Comment 6 Liushihui 2015-04-02 09:06:40 UTC
Verified it on virt-who-0.12-2.el6.noarch.

Verified version:
virt-who-0.12-2.el6.noarch
subscription-manager-1.14.1-1.el6.x86_64
python-rhsm-1.14.1-1.el6.x86_64
Satellite-5.7.0-RHEL6-re20150108.2-x86_64

Verified process:
1.Register rhel to Satellite-5.7
[root@hp-z220-06 rhn]# rhnreg_ks --username virtwho_test --password=redhat123
[root@hp-z220-06 rhn]# subscription-manager identity
server type: RHN Classic
2.Configure virt-who in /etc/sysconfig/virt-who as the following:
[root@hp-z220-06 rhn]# cat /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=10
VIRTWHO_SATELLITE5=1
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=ACME_Corporation
VIRTWHO_ESX_ENV=Library
VIRTWHO_ESX_SERVER=10.66.79.68
VIRTWHO_ESX_USERNAME=Administrator
VIRTWHO_ESX_PASSWORD=qwer1234P!
VIRTWHO_SATELLITE_SERVER=satellite57.redhat.com
VIRTWHO_SATELLITE_USERNAME=virtwho_test
VIRTWHO_SATELLITE_PASSWORD=redhat123
3.Restart virt-who service and check the virt-who's log file.
[root@hp-z220-06 rhn]# service virt-who restart
Stopping virt-who:                                         [FAILED]
Starting virt-who:                                         [  OK  ]
[root@hp-z220-06 rhn]# tail -f /var/log/rhsm/rhsm.log
2015-04-02 16:52:18,585 [INFO]  @virtwho.py:475 - Using configuration "env/cmdline" ("esx" mode)
2015-04-02 16:52:18,585 [DEBUG]  @virtwho.py:131 - Starting infinite loop with 10 seconds interval
2015-04-02 16:52:18,736 [DEBUG]  @esx.py:51 - Log into ESX
2015-04-02 16:52:21,231 [DEBUG]  @esx.py:54 - Creating ESX event filter
2015-04-02 16:52:21,540 [DEBUG]  @esx.py:113 - Waiting for ESX changes
2015-04-02 16:52:21,560 [DEBUG]  @satellite.py:60 - Initializing satellite connection to https://satellite57.redhat.com/XMLRPC
2015-04-02 16:52:21,560 [INFO]  @satellite.py:66 - Initialized satellite connection
2015-04-02 16:52:21,561 [INFO]  @satellite.py:147 - Sending update in hosts-to-guests mapping: {564d20f4-71b7-acdb-f875-d64ecec4a6c0: [4226082e-2746-17dc-6f01-dc91c6fc7fbb, 4224d6d4-b9ef-cd33-8f19-56bcfc179ed5]}
2015-04-02 16:52:21,561 [DEBUG]  @satellite.py:152 - Loading systemid for 564d20f4-71b7-acdb-f875-d64ecec4a6c0
2015-04-02 16:52:21,561 [DEBUG]  @satellite.py:74 - Loading system id info from /var/lib/virt-who/hypervisor-systemid-564d20f4-71b7-acdb-f875-d64ecec4a6c0
2015-04-02 16:52:21,918 [DEBUG]  @satellite.py:97 - New system created in satellite, system id saved in /var/lib/virt-who/hypervisor-systemid-564d20f4-71b7-acdb-f875-d64ecec4a6c0
2015-04-02 16:52:21,919 [DEBUG]  @satellite.py:155 - Building plan for hypervisor 564d20f4-71b7-acdb-f875-d64ecec4a6c0: [4226082e-2746-17dc-6f01-dc91c6fc7fbb, 4224d6d4-b9ef-cd33-8f19-56bcfc179ed5]
2015-04-02 16:52:21,919 [DEBUG]  @satellite.py:159 - Sending plan: [[0, 'exists', 'system', {'uuid': '0000000000000000', 'identity': 'host'}], [0, 'crawl_began', 'system', {}], [0, 'exists', 'domain', {'state': 'running', 'memory_size': 0, 'name': u'VM from esx hypervisor 564d20f4-71b7-acdb-f875-d64ecec4a6c0', 'virt_type': 'fully_virtualized', 'vcpus': 1, 'uuid': '4226082e274617dc6f01dc91c6fc7fbb'}], [0, 'exists', 'domain', {'state': 'running', 'memory_size': 0, 'name': u'VM from esx hypervisor 564d20f4-71b7-acdb-f875-d64ecec4a6c0', 'virt_type': 'fully_virtualized', 'vcpus': 1, 'uuid': '4224d6d4b9efcd338f1956bcfc179ed5'}], [0, 'crawl_ended', 'system', {}]]

Result:
virt-who can send the host/gust mappping to satellite5.7 server and the hyeprvisor will show on the satellite web UI.

Comment 7 errata-xmlrpc 2015-07-22 07:15: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-2015-1377.html