Bug 1009230 - Unregister to the SAM server will result in virt-who dead
Unregister to the SAM server will result in virt-who dead
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: virt-who (Show other bugs)
6.5
x86_64 All
unspecified Severity urgent
: rc
: ---
Assigned To: Radek Novacek
John Sefler
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-17 23:30 EDT by Liushihui
Modified: 2016-11-30 19:31 EST (History)
6 users (show)

See Also:
Fixed In Version: virt-who-0.10-1.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-10-14 03:13:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
command line (12.96 KB, text/plain)
2014-04-23 04:15 EDT, Liushihui
no flags Details
virt-who log (195.88 KB, text/x-log)
2014-04-23 04:16 EDT, Liushihui
no flags Details

  None (edit)
Description Liushihui 2013-09-17 23:30:07 EDT
Description of problem:
After unregister to SAM server ,virt-who service will dead

Version-Release number of selected component (if applicable):
subscription-manager-1.9.6-1.el6.x86_64
python-rhsm-1.9.6-1.el6.x86_64
virt-who-0.8-9.el6.noarch
katello-headpin-1.4.3-13.el6sam_splice.noarch
candlepin-0.8.26-1.el6sam.noarch

How reproducible:
Always

Steps to Reproduce:
1.Restart the virt-who service
[root@hp-z220-03 ~]# service virt-who restart
Stopping virt-who:                                         [FAILED]
Starting virt-who:                                         [  OK  ]
2.Unregister to SAM server
[root@hp-z220-03 ~]# subscription-manager unregister
System has been unregistered.
3.Check the virt-who status, please see the rhsm.log in the addtional info.
[root@hp-z220-03 ~]# service virt-who status
virt-who dead but subsys locked
4.Check the register status
[root@hp-z220-03 ~]# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.


Actual results:
Virt-who dead after unregister to SAM server successfully.

Expected results:
Virt-who work normally after unregister to SAM server successfully.

Additional info:
2013-09-18 11:10:20,960 [DEBUG]  @subscriptionmanager.py:89 - Sending update in hosts-to-guests mapping: {44454c4c-4c00-1031-8053-b8c04f4e3258: [564d6475-75d9-f2a5-b112-784a9d84aac5]}
2013-09-18 11:10:23,016 [DEBUG]  @plugins.py:519 - loaded plugin modules: []
2013-09-18 11:10:23,016 [DEBUG]  @plugins.py:520 - loaded plugins: {}
2013-09-18 11:10:23,038 [DEBUG]  @identity.py:130 - Loading consumer info from identity certificates.
2013-09-18 11:10:23,043 [DEBUG]  @profile.py:96 - Loading current RPM profile.
2013-09-18 11:10:23,129 [INFO]  @managercli.py:292 - Client Versions: {'python-rhsm': '1.9.6-1.el6', 'subscription-manager': '1.9.6-1.el6'}
2013-09-18 11:10:23,130 [INFO]  @connection.py:646 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2013-09-18 11:10:23,130 [INFO]  @connection.py:657 - Connection Built: host: samserv.redhat.com, port: 443, handler: /sam/api
2013-09-18 11:10:23,130 [INFO]  @connection.py:653 - Using no auth
2013-09-18 11:10:23,130 [INFO]  @connection.py:657 - Connection Built: host: samserv.redhat.com, port: 443, handler: /sam/api
2013-09-18 11:10:23,158 [DEBUG]  @connection.py:420 - Loading CA PEM certificates from: /etc/rhsm/ca/
2013-09-18 11:10:23,158 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2013-09-18 11:10:23,158 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/candlepin-local.pem'
2013-09-18 11:10:23,158 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2013-09-18 11:10:23,159 [DEBUG]  @connection.py:441 - Making request: GET /sam/api/
2013-09-18 11:10:23,209 [DEBUG]  @connection.py:460 - Response status: 200
2013-09-18 11:10:23,209 [DEBUG]  @connection.py:673 - Server supports the following resources:
2013-09-18 11:10:23,209 [DEBUG]  @connection.py:674 - {'status': '/api/status/', 'organizations': '/api/organizations/', 'roles': '/api/roles/', 'sync_plans': '/api/sync_plans/', 'users': '/api/users/', 'distributors': '/api/distributors/', 'providers': '/api/providers/', 'entitlements': '/api/entitlements/', 'content_views': '/api/content_views/', 'system_groups': '/api/system_groups/', 'products': '/api/products/', 'systems': '/api/systems/', 'activation_keys': '/api/activation_keys/', 'content_view_definitions': '/api/content_view_definitions/', 'consumers': '/api/consumers/'}
2013-09-18 11:10:23,209 [DEBUG]  @connection.py:420 - Loading CA PEM certificates from: /etc/rhsm/ca/
2013-09-18 11:10:23,209 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2013-09-18 11:10:23,210 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/candlepin-local.pem'
2013-09-18 11:10:23,210 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2013-09-18 11:10:23,210 [DEBUG]  @connection.py:441 - Making request: GET /sam/api/status
2013-09-18 11:10:23,234 [DEBUG]  @connection.py:460 - Response status: 200
2013-09-18 11:10:23,234 [INFO]  @managercli.py:303 - Server Versions: {'candlepin': '1.4.3-13.el6sam_splice-Headpin', 'server-type': 'Red Hat Subscription Management'}
2013-09-18 11:10:23,237 [DEBUG]  @connection.py:420 - Loading CA PEM certificates from: /etc/rhsm/ca/
2013-09-18 11:10:23,237 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2013-09-18 11:10:23,238 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/candlepin-local.pem'
2013-09-18 11:10:23,238 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2013-09-18 11:10:23,239 [DEBUG]  @connection.py:441 - Making request: DELETE /sam/api/consumers/32a5f900-857b-43bd-9aae-b105e04bf932
2013-09-18 11:10:23,457 [DEBUG]  @connection.py:460 - Response status: 204
2013-09-18 11:10:23,458 [INFO]  @managerlib.py:767 - Successfully un-registered.
2013-09-18 11:10:23,459 [DEBUG]  @identity.py:130 - Loading consumer info from identity certificates.
2013-09-18 11:10:23,460 [INFO]  @cache.py:116 - Deleting cache: /var/lib/rhsm/facts/facts.json
2013-09-18 11:10:23,460 [INFO]  @cache.py:116 - Deleting cache: /var/lib/rhsm/cache/installed_products.json
2013-09-18 11:10:23,460 [INFO]  @cache.py:116 - Deleting cache: /var/lib/rhsm/cache/entitlement_status.json
2013-09-18 11:10:23,461 [INFO]  @certlib.py:243 - certs updated:
Total updates: 0
Found (local) serial# []
Expected (UEP) serial# []
Added (new)
  <NONE>
Deleted (rogue):
  <NONE>
2013-09-18 11:10:23,462 [INFO]  @repolib.py:158 - repos updated: 0
2013-09-18 11:10:23,463 [INFO]  @facts.py:73 - Cache /var/lib/rhsm/facts/facts.json does not exit
2013-09-18 11:10:23,468 [DEBUG]  @hwprobe.py:518 - cpu info: {'cpu.cpu(s)': 4, 'cpu.core(s)_per_socket': 4, 'cpu.thread(s)_per_core': 1, 'cpu.topology_source': 'kernel /sys cpu sibling lists', 'cpu.cpu_socket(s)': 1}
2013-09-18 11:10:24,424 [INFO]  @facts.py:137 - Loading custom facts from: /etc/rhsm/facts/custom.facts
2013-09-18 11:10:24,425 [DEBUG]  @certdirectory.py:204 - Installed product IDs: ['69']
2013-09-18 11:10:24,425 [DEBUG]  @cert_sorter.py:134 - Unregistered, skipping server compliance check.
2013-09-18 11:10:24,573 [INFO]  @rhsmd:192 - rhsmd started
2013-09-18 11:10:24,584 [INFO]  @rhsmd:147 - D-Bus interface com.redhat.SubscriptionManager.EntitlementStatus.update_status called with status = 0
2013-09-18 11:10:24,619 [INFO]  @rhsmd:115 - D-Bus signal com.redhat.SubscriptionManager.EntitlementStatus.entitlement_status_changed emitted
2013-09-18 11:10:24,619 [DEBUG]  @utils.py:378 - Restarted virt-who
2013-09-18 11:10:24,627 [ERROR]  @virt-who.py:124 - Unable to obtain status from server, UEPConnection is likely not usable:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 115, in initSM
    self.subscriptionManager = SubscriptionManager(self.logger)
  File "/usr/share/virt-who/subscriptionmanager.py", line 42, in __init__
    self.readConfig()
  File "/usr/share/virt-who/subscriptionmanager.py", line 56, in readConfig
    raise SubscriptionManagerError("Unable to read certificate, system is not registered or you are not root")
SubscriptionManagerError: Unable to read certificate, system is not registered or you are not root
2013-09-18 11:10:24,628 [ERROR]  @virt-who.py:560 - Fatal error:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 555, in <module>
    main()
  File "/usr/share/virt-who/virt-who.py", line 542, in main
    virtWho.reloadConfig()
  File "/usr/share/virt-who/virt-who.py", line 254, in reloadConfig
    self.checkConnections()
  File "/usr/share/virt-who/virt-who.py", line 155, in checkConnections
    self.initSM()
  File "/usr/share/virt-who/virt-who.py", line 115, in initSM
    self.subscriptionManager = SubscriptionManager(self.logger)
  File "/usr/share/virt-who/subscriptionmanager.py", line 42, in __init__
    self.readConfig()
  File "/usr/share/virt-who/subscriptionmanager.py", line 56, in readConfig
    raise SubscriptionManagerError("Unable to read certificate, system is not registered or you are not root")
SubscriptionManagerError: Unable to read certificate, system is not registered or you are not root
2013-09-18 11:10:24,628 [ERROR]  @virt-who.py:560 - Fatal error:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt-who.py", line 555, in <module>
    main()
  File "/usr/share/virt-who/virt-who.py", line 542, in main
    virtWho.reloadConfig()
  File "/usr/share/virt-who/virt-who.py", line 254, in reloadConfig
    self.checkConnections()
  File "/usr/share/virt-who/virt-who.py", line 155, in checkConnections
    self.initSM()
  File "/usr/share/virt-who/virt-who.py", line 115, in initSM
    self.subscriptionManager = SubscriptionManager(self.logger)
  File "/usr/share/virt-who/subscriptionmanager.py", line 42, in __init__
    self.readConfig()
  File "/usr/share/virt-who/subscriptionmanager.py", line 56, in readConfig
    raise SubscriptionManagerError("Unable to read certificate, system is not registered or you are not root")
SubscriptionManagerError: Unable to read certificate, system is not registered or you are not root

[NOTE]:Do the same test on the RHEL-5.10-Server--x86_64-RC-1.4(20130910.0), it hasn't this problem , the normal component is as the following
subscription-manager-1.8.22-1.el5
python-rhsm-1.8.17-1.el5
virt-who-0.7-9.el5
katello-headpin-1.4.3-13.el6sam_splice.noarch
candlepin-0.8.26-1.el6sam.noarch
Comment 2 Liushihui 2013-09-29 05:13:04 EDT
Unregister to stage candlepin also have the same problem
Comment 3 RHEL Product and Program Management 2013-10-13 22:06:14 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 4 Liushihui 2013-10-15 02:22:44 EDT
It still exist on RHEL6.5-Snapshot-3(20131009.0)-Server-x86_64
Comment 5 Liushihui 2013-12-02 00:40:59 EST
In the RHEL-7.0-20131127.1-Server-x86_64, It can't reproduce this bug as the above steps every time, But it must reproduce as the following conditions:
1. # cat /etc/sysconfig/virt-who , set as the following:
   VIRTWHO_BACKGROUND=1
   VIRTWHO_DEBUG=0
                ^^^
   VIRTWHO_INTERVAL=2
2. On the terminal1: Restart virt-who service
[root@dhcp-65-175 product]# systemctl restart virt-who
3. On the terminal2: unregistered to SAM server:
[root@dhcp-65-175 ~]# subscription-manager unregister
System has been unregistered.
4.Check the virt-who status on the terminal1
root@dhcp-65-175 product]# systemctl restart virt-who

Actual results:
[root@dhcp-65-175 product]# systemctl restart virt-who
Job for virt-who.service failed. See 'systemctl status virt-who.service' and 'journalctl -xn' for details.
[root@dhcp-65-175 product]# systemctl status virt-who
virt-who.service - Daemon for reporting virtual guest IDs to subscription-manager
   Loaded: loaded (/usr/lib/systemd/system/virt-who.service; disabled)
   Active: failed (Result: timeout) since Mon 2013-12-02 13:38:53 CST; 3s ago
  Process: 5687 ExecStart=/usr/bin/virt-who (code=exited, status=0/SUCCESS)
 Main PID: 5584 (code=exited, status=0/SUCCESS)

Dec 02 13:38:50 dhcp-65-175.nay.redhat.com python[5687]: Sending update in hosts-to-guests mapping: {'60527517-6284-7593-6AAB-75BF2...73F']}
Dec 02 13:38:51 dhcp-65-175.nay.redhat.com virt-who[5687]: DEBUG: Using NTLM authentication
Dec 02 13:38:51 dhcp-65-175.nay.redhat.com python[5687]: Using NTLM authentication
Dec 02 13:38:51 dhcp-65-175.nay.redhat.com virt-who[5687]: DEBUG: NTLM authentication successful
Dec 02 13:38:51 dhcp-65-175.nay.redhat.com python[5687]: NTLM authentication successful
Dec 02 13:38:52 dhcp-65-175.nay.redhat.com virt-who[5687]: DEBUG: Sending update in hosts-to-guests mapping: {'60527517-6284-7593-6...73F']}
Dec 02 13:38:52 dhcp-65-175.nay.redhat.com python[5687]: Sending update in hosts-to-guests mapping: {'60527517-6284-7593-6AAB-75BF2...73F']}
Dec 02 13:38:52 dhcp-65-175.nay.redhat.com systemd[1]: virt-who.service operation timed out. Terminating.
Dec 02 13:38:53 dhcp-65-175.nay.redhat.com systemd[1]: Failed to start Daemon for reporting virtual guest IDs to subscription-manager.
Dec 02 13:38:53 dhcp-65-175.nay.redhat.com systemd[1]: Unit virt-who.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
Comment 6 Devan Goodwin 2014-04-16 07:51:17 EDT
Hi Liushihui, this is unfortunately expected behaviour. The decision was made that virt-who uses the registered system credentials, thus why it has to be run on a registered RHEL system. Unregister that system, and virt-who can no longer authenticate to report hosts.

Closing as NOTABUG.
Comment 7 Liushihui 2014-04-22 02:36:18 EDT
Hi Devan,
  
   After unregister that system, Virt-who will failed if it was "disable debugging output" in the virt-who configure, please see comment 5. However, Virt-who still run normally if it was "enable debugging output" in the virt-who configure. 
   According to your explain, No matter virt-who enable or disable debugging output, it should still failed after unregister system, what's your opinion?


(In reply to Devan Goodwin from comment #6)
> Hi Liushihui, this is unfortunately expected behaviour. The decision was
> made that virt-who uses the registered system credentials, thus why it has
> to be run on a registered RHEL system. Unregister that system, and virt-who
> can no longer authenticate to report hosts.
> 
> Closing as NOTABUG.
Comment 8 Radek Novacek 2014-04-22 03:34:44 EDT
virt-who behavior shouldn't be affected by enabling the debug mode.

It looks like that virt-who has different behavior on RHEL-6 and RHEL-7 (possibly because of systemd).

Could you please try if it's really affected by the debug mode on RHEL-6? Thank you.
Comment 9 Liushihui 2014-04-23 04:12:04 EDT
Hi Radek,

  I have retest it on the RHEL6 and RHEL7, it has the phenomenon in the RHEL6 and RHEL7. virt-who behavior isn't affected by enabling the debug mode, it maybe affected by the VIRTWHO_INTERVEL.
  When I set the VIRTWHO_INTERVEL to 1 , Then unregister the system, virt-who still run normally(But it can't reproduce everytime). However, when I set the VIRTWHO_INTERVEL to 3600, Then unregister the system, virt-who will dead(reproduce everytime), please see the command line and the virt-who log in the attachment. 


(In reply to Radek Novacek from comment #8)
> virt-who behavior shouldn't be affected by enabling the debug mode.
> 
> It looks like that virt-who has different behavior on RHEL-6 and RHEL-7
> (possibly because of systemd).
> 
> Could you please try if it's really affected by the debug mode on RHEL-6?
> Thank you.
Comment 10 Liushihui 2014-04-23 04:15:03 EDT
Created attachment 888799 [details]
command line
Comment 11 Liushihui 2014-04-23 04:16:40 EDT
Created attachment 888800 [details]
virt-who log
Comment 12 Liushihui 2014-04-23 04:17:59 EDT
It has the same phenomenon on the RHEL6 and RHEL7.
Comment 13 Radek Novacek 2014-05-16 04:29:40 EDT
I've decided that virt-who shouldn't die when system is being unregistered or is not registered at all (see bug 1092848). This bug is caused by missing exception handling in SIGHUP signal (that is emitted when the system is unregistered).

Reopening this bug and targeting RHEL-6.6.
Comment 14 Radek Novacek 2014-05-16 05:12:34 EDT
Upstream commit that fixes this issue: https://git.fedorahosted.org/cgit/virt-who.git/commit/.
Comment 15 Radek Novacek 2014-06-02 05:50:16 EDT
This bug is fixed upstream and will be resolved by rebase of virt-who, see bug 1002640.
Comment 16 Radek Novacek 2014-06-18 03:25:50 EDT
This bug is fixed by rebase to virt-who-0.10-1.el6.
Comment 18 Liushihui 2014-07-28 02:05:13 EDT
Verified on virt-who-0.10-3.el6.noarch
Comment 19 errata-xmlrpc 2014-10-14 03:13:07 EDT
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.

http://rhn.redhat.com/errata/RHBA-2014-1513.html

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