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 1223236

Summary: virt-who sub-process hasn't been killed after unregister system
Product: Red Hat Enterprise Linux 6 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED DUPLICATE QA Contact: gaoshang <sgao>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.7CC: gxing, hsun, ovasik, rbalakri, sgao, shihliu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-09 07:11:05 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-05-20 07:44:23 UTC
Description of problem:
After unregister system, virt-who sub-process still exist.

Version-Release number of selected component (if applicable):
virt-who-0.12-8.el6.noarch
subscription-manager-1.14.6-1.el6.x86_64
python-rhsm-1.14.2-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Register system to Satellite, make virt-who run at default mode. then check the virt-who process.
[root@rhel67latest ~]# service virt-who restart
Stopping virt-who:                                         [FAILED]
Starting virt-who:                                         [  OK  ]
[root@rhel67latest ~]# subscription-manager register --username=admin --password=admin
The system has been registered with ID: 8b8b7e68-ae5c-4f38-8b35-db1db08ffcf0 
[root@rhel67latest ~]# ps -ef|grep virt-who
root      4313     1  0 02:22 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      4348  4313  0 02:23 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      4355  2797  0 02:23 pts/1    00:00:00 grep virt-who
2. Unregister system, then check the virt-who process
[root@rhel67latest ~]# subscription-manager unregister
System has been unregistered.
[root@rhel67latest ~]# ps -ef|grep virt-who
root      4313     1  0 02:22 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      4348  4313  0 02:23 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root      4361  2797  0 02:23 pts/1    00:00:00 grep virt-who
3. Check virt-who's log 
# tail -f /var/log/rhsm/rhsm.log

Actual results:
The sub-process 4348 still exist, it also hasn't generate any error log to remind " system is not registered or you are not root"


Expected results:
The sub-process should be killed when unregister system. it also should generate error log when system has been unregistered. the error log should as the following:
2015-05-20 15:22:57,668 [INFO]  @virtwho.py:554 - Reloading
2015-05-20 15:22:57,669 [DEBUG]  @virtwho.py:143 - Starting infinite loop with 30 seconds interval
2015-05-20 15:22:57,671 [INFO]  @libvirtd.py:120 - Using libvirt url: ""
2015-05-20 15:22:57,683 [DEBUG]  @libvirtd.py:200 - Libvirt domains found: []
2015-05-20 15:22:57,685 [DEBUG]  @subscriptionmanager.py:75 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-05-20 15:22:57,686 [ERROR]  @virtwho.py:111 - Error in communication with subscription manager:
Traceback (most recent call last):
  File "/usr/share/virt-who/virtwho.py", line 102, in send
    self._sendGuestList(report)
  File "/usr/share/virt-who/virtwho.py", line 121, in _sendGuestList
    manager.sendVirtGuests(report.guests)
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 104, in sendVirtGuests
    self._connect()
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 77, in _connect
    raise SubscriptionManagerUnregisteredError("Unable to read certificate, system is not registered or you are not root")

Additional info:

Comment 2 Liushihui 2015-05-20 08:45:24 UTC
It don't exist on virt-who-0.12-7.el6.noarch

Comment 3 Liushihui 2015-05-20 08:55:55 UTC
After occurred this problem, re-register system to Satellite, virt-who can't send host/guest mapping to Satellite although virt-who still run normally.

Comment 4 Radek Novacek 2015-05-26 10:45:42 UTC
Is the virt-who configuration anyhow special? I'm not able to reproduce this bug at all.

Can you please install python-debuginfo and gdb packages on affected system, run following command and post the result here:

for p in $(pgrep -f virt-who); do gdb -ex py-bt --batch -p $p; done

Comment 5 Liushihui 2015-06-01 04:06:54 UTC
Radek, it still exist on virt-who-0.12-8.el6.noarch. when unregister system, it still has the same problem. virt-who hasn't any specially configuration, just as the following:
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=5

Check it as the following steps:
1 Register system to satellite and check virt-who's process
[root@hp-z220-05 ~]# subscription-manager register --username=admin --password=admin
The system has been registered with ID: 65fca01e-f909-4bf1-bd84-c54cccc84018 
[root@hp-z220-05 ~]# service virt-who status
virt-who (pid  21290) is running...
[root@hp-z220-05 ~]# ps -ef|grep virt-who
root     21290     1  0 11:56 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     21553 21290  0 11:57 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     21649 16809  0 11:57 pts/1    00:00:00 grep virt-who
2 Unregister system and check the virt-who's process and log.
[root@hp-z220-05 ~]# tail -f /var/log/rhsm/rhsm.log
[root@hp-z220-05 ~]# subscription-manager unregister
System has been unregistered.
[root@hp-z220-05 ~]# ps -ef|grep virt-who
root     21290     1  0 11:56 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     21553 21290  0 11:57 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
root     21730 16809  0 11:58 pts/1    00:00:00 grep virt-who
[root@hp-z220-05 ~]# rpm -q virt-who
virt-who-0.12-8.el6.noarch

Result:
After unregister system, virt-who's subprocess 21553 still exist. virt-who still can't show ""Unable to read certificate, system is not registered or you are not root")".However, it will show some error as the following:
=============================================================
2015-06-01 11:58:06,529 [DEBUG] subscription-manager:21651 @connection.py:446 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, redhat-uep.pem, katello-server-ca.pem, candlepin-local.pem
2015-06-01 11:58:06,530 [DEBUG] subscription-manager:21651 @connection.py:494 - Making request: DELETE /rhsm/consumers/65fca01e-f909-4bf1-bd84-c54cccc84018
2015-06-01 11:58:10,383 [ERROR]  @virtwho.py:122 - Error in communication with subscription manager:
Traceback (most recent call last):
  File "/usr/share/virt-who/virtwho.py", line 102, in send
    self._sendGuestList(report)
  File "/usr/share/virt-who/virtwho.py", line 128, in _sendGuestList
    manager.sendVirtGuests(report.guests)
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 119, in sendVirtGuests
    self.connection.updateConsumer(self.uuid(), guest_uuids=domains)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 858, in updateConsumer
    ret = self.conn.request_put(method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 611, in request_put
    return self._request("PUT", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 530, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 572, in validateResponse
    raise RestlibException(response['status'], error_msg)
RestlibException: Task 54a1fd06-ad97-44fc-9039-9a4b7fa7a9d9: Katello::Errors::CandlepinError: Unit with ID '65fca01e-f909-4bf1-bd84-c54cccc84018' could not be found.
2015-06-01 11:58:10,405 [DEBUG]  @subscriptionmanager.py:75 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-06-01 11:58:10,533 [DEBUG] subscription-manager:21651 @connection.py:521 - Response: status=204
2015-06-01 11:58:10,534 [INFO] subscription-manager:21651 @managerlib.py:789 - Successfully un-registered.
=================================================================

Comment 6 Liushihui 2015-06-03 02:12:13 UTC
It hasn't this problem when virt-who against SAM1.4.1

Comment 7 Radek Novacek 2015-06-04 06:37:40 UTC
virt-who-0.12-9.el6 contains couple of fixes that might also solve this issue. Could you please try that version of virt-who? Thanks.

Comment 8 Liushihui 2015-06-05 05:47:36 UTC
It still exist on virt-who-0.12-9.el6, the phenomenon is the same as it on bug's description.please see the detail as the following:

[root@hp-z220-07 ~]# subscription-manager unregister
System has been unregistered.
[root@hp-z220-07 ~]# ps -ef|grep virt who                                                                                                                               
root     12433     1  0 13:42 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py
===========================================================================
root     12439 12433  0 13:42 ?        00:00:00 /usr/bin/python /usr/share/virt-who/virtwho.py   ==> this subprocess still exist after unregistered sytem
===========================================================================
root     12456 12209  0 13:43 pts/1    00:00:00 grep virt-who
[root@hp-z220-07 ~]# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

Comment 9 Liushihui 2015-06-08 07:48:57 UTC
When this problem has occurred, re-register to Satellite server, virt-who failed to send host/guest association to Satellite.

Comment 10 Radek Novacek 2015-06-09 07:11:05 UTC
This looks like it's duplicate of 1207984.

*** This bug has been marked as a duplicate of bug 1207984 ***