Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1398639

Summary: virt-who ignores rhsm_username and rhsm_password on vdsm mode
Product: Red Hat Enterprise Linux 6 Reporter: Julio Entrena Perez <jentrena>
Component: virt-whoAssignee: Chris Snyder <csnyder>
Status: CLOSED NOTABUG QA Contact: Eko <hsun>
Severity: high Docs Contact:
Priority: high    
Version: 6.8CC: egolov, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-28 12:33:16 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 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.