Bug 1398639 - virt-who ignores rhsm_username and rhsm_password on vdsm mode
Summary: virt-who ignores rhsm_username and rhsm_password on vdsm mode
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: virt-who
Version: 6.8
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Chris Snyder
QA Contact: Eko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-25 13:00 UTC by Julio Entrena Perez
Modified: 2020-01-17 16:15 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-28 12:33:16 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github virt-who virt-who pull 35 0 'None' closed fixes RHBZ#1398639 - use the defined config when submitting local guests 2021-01-14 12:48:55 UTC

Description Julio Entrena Perez 2016-11-25 13:00:56 UTC
Description of problem:
Running virt-who on a host that is not registered via subscription-manager by specifying rhsm_username and rhsm_password options instead fails sicne virt-who still looks for the certificate at /etc/pki/consumer/cert.pem which does not exist since the host is not registered.

Version-Release number of selected component (if applicable):
virt-who-0.17-9.el6sat

How reproducible:
Always

Steps to Reproduce:
1. Create a configuration in vdsm mode:

# cat /etc/virt-who.d/example.conf
[sat6]
rhsm_username=admin
rhsm_password=redhat
type=vdsm
owner=ACME
env=Library
hypervisor_id=hostname
rhsm_hostname=satellite.example.com
rhsm_prefix=/rhsm

2.
3.

Actual results:

virt-who still looks for /etc/pki/consumer/cert.pem and fails if the host is not registered.

2016-11-23 13:09:43,636 [virtwho.main DEBUG] MainProcess(13454):MainThread @subscriptionmanager.py:_connect:123 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-11-23 13:09:43,638 [virtwho.sat6 DEBUG] Vdsm-1(13463):MainThread @virt.py:run:389 - Virt backend 'sat6' terminated
2016-11-23 13:09:43,643 [virtwho.main ERROR] MainProcess(13454):MainThread @main.py:_main:189 - Fatal error:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/virtwho/main.py", line 186, in _main
    result = executor.run()
  File "/usr/lib/python2.6/site-packages/virtwho/executor.py", line 256, in run
    self.send_report(report.config.name, report)
  File "/usr/lib/python2.6/site-packages/virtwho/executor.py", line 95, in send_report
    if self.send(report):
  File "/usr/lib/python2.6/site-packages/virtwho/executor.py", line 137, in send
    self._sendGuestList(report)
  File "/usr/lib/python2.6/site-packages/virtwho/executor.py", line 162, in _sendGuestList
    manager.sendVirtGuests(report, self.options)
  File "/usr/lib/python2.6/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 144, in sendVirtGuests
    self._connect()
  File "/usr/lib/python2.6/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 126, in _connect
    "Unable to read certificate, system is not registered or you are not root")
SubscriptionManagerUnregisteredError: Unable to read certificate, system is not registered or you are not root


Expected results:

virt-who honours rhsm_username and rhsm_password and ignores the lack of certificate file /etc/pki/consumer/cert.pem .

Additional info:

Comment 1 Julio Entrena Perez 2016-11-25 14:48:50 UTC
Thanks Evgeni.

The backtrace no longer happens and the guest report is collected but it still fails to send:

2016-11-25 14:44:13,160 [virtwho.main INFO] MainProcess(20531):MainThread @subscriptionmanager.py:sendVirtGuests:152 - Sending update in guests lists for config "sat6": 2 guests found
2016-11-25 14:44:13,161 [virtwho.main DEBUG] MainProcess(20531):MainThread @subscriptionmanager.py:sendVirtGuests:153 - Domain info: [
    {
        "guestId": "38461991-06d4-486e-9275-aacfa92d7615", 
        "state": 1, 
        "attributes": {
            "active": 1, 
            "virtWhoType": "vdsm"
        }
    }, 
    {
        "guestId": "6384d4ae-ad0c-429c-bec7-3b3e1394558d", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "virtWhoType": "vdsm"
        }
    }
]
2016-11-25 14:44:13,165 [virtwho.main ERROR] MainProcess(20531):MainThread @executor.py:send:143 - Unable to send data: Unable to open certificate /etc/pki/consumer/cert.pem ([Errno 2] No such file or directory: '/etc/pki/consumer/cert.pem'):
2016-11-25 14:44:13,165 [virtwho.main DEBUG] MainProcess(20531):MainThread @executor.py:send_report:108 - Report from "sat6" failed to sent
2016-11-25 14:44:31,555 [virtwho.sat6 DEBUG] Vdsm-1(20538):MainThread @virt.py:run:395 - Virt backend 'sat6' interrupted

Comment 2 Evgeni Golov 2016-11-25 19:48:41 UTC
Hey,

sorry, I missed that second error in my first try. After re-reading the code and thinking bit, I think what you are trying is not possible.

Let me explain why:

* vdsm mode means virt-who runs in "I am the hypervisor and those are my guests" mode
* to be able to provide guests with a subscription, the hypervisor has to be subscribed
* your hypervisor is not subscribed to the satellite, so you cannot provide it with a VDC sub and thus your setup will never work (and that is why it needs a cert to get its subscription UUID from).

You cannot submit "my hypervisors are: …" to the satellite if "you" are not known to the satellite.


Note You need to log in before you can comment on or make changes to this bug.