Bug 1243341

Summary: It hasn't show error info when failed to start virt-who service
Product: Red Hat Enterprise Linux 7 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: xingge <gxing>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: gxing, hsun, ldai, lmiksik, ovasik, sgao, tlavigne
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.14-8.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:56:30 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-07-15 09:15:15 UTC
Description of problem:
When fail to start virt-who service ,it hasn't show error info in the terminal side.

Version-Release number of selected component (if applicable):
virt-who-0.14-1.el7.noarch
subscription-manager-1.15.5-1.el7.x86_64
python-rhsm-1.15.3-1.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Register rhel to Satellite.
2. Configure virt-who with encrypted password, and decrypted password doesn't exist.
[root@hp-z220-06 virt-who.d]# cat /etc/virt-who.d/virt-who
[test-esx1]
type=esx
server=10.66.79.27
username=Administrator
encrypted_password=43f282d679adb816f2bb1cf9c18949ec
owner=ACME_Corporation
env=Library
3. Restart virt-who service
[root@hp-z220-06 virt-who.d]# systemctl start virt-who
[root@hp-z220-06 virt-who.d]# 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; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2015-07-15 16:38:18 CST; 35min ago
  Process: 32394 ExecStart=/usr/bin/virt-who (code=exited, status=1/FAILURE)
 Main PID: 32394 (code=exited, status=1/FAILURE)

Actual results:
Although it failed to start virt-who service, it hasn't show the failed status in the terminal side.

Expected results:
As it failed to start virt-who service, it should show error info in the terminl side.

Additional info:
When password or key is broken (wrong length), it also need to show error info in the terminal side after restart virt-who service.

Comment 2 Radek Novacek 2015-07-16 13:52:55 UTC
I do see the error message in the `systemctl status virt-who` output:

● virt-who.service - Daemon for reporting virtual guest IDs to subscription-manager
   Loaded: loaded (/usr/lib/systemd/system/virt-who.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Čt 2015-07-16 15:48:09 CEST; 2s ago
  Process: 6626 ExecStart=/usr/bin/virt-who (code=exited, status=1/FAILURE)
 Main PID: 6626 (code=exited, status=1/FAILURE)

čec 16 15:48:09 rhel7.virt systemd[1]: Started Daemon for reporting virtual guest IDs to subscription-manager.
čec 16 15:48:09 rhel7.virt systemd[1]: Starting Daemon for reporting virtual guest IDs to subscription-manager...
čec 16 15:48:09 rhel7.virt python[6626]: Password can't be decrypted, possibly corrupted
čec 16 15:48:09 rhel7.virt systemd[1]: virt-who.service: main process exited, code=exited, status=1/FAILURE
čec 16 15:48:09 rhel7.virt systemd[1]: Unit virt-who.service entered failed state.
čec 16 15:48:09 rhel7.virt systemd[1]: virt-who.service failed.


If you mean that it should be display after 'systemctl start virt-who`, that's not possible as systemd doesn't allow that. It just triggers the restart and doesn't check the status of that service. You have to use the `status` command to make sure that the service started successfully.

Comment 3 Liushihui 2015-07-31 03:55:06 UTC
Radek, Thanks for your explain. I means it should show remind info when failed to start virt-who service, thesefore, customers can track virt-who's status directly. 
For example, when it failed to start nfs service ,it will show these remind info as the following. Therefore, I hope virt-who also can show these info when failed to start virt-who service. is that acceptable?

[root@hp-z220-05 ~]# systemctl restart nfs
Job for nfs-server.service failed because control process exited with error code. See "systemctl status nfs-server.service" and "journalctl -xe" for details.

Comment 4 Radek Novacek 2015-08-25 17:09:39 UTC
Fixed in virt-who-0.14-5.el7.

Comment 6 Liushihui 2015-09-06 03:49:51 UTC
It still exist on virt-who-0.14-7.el7.noarch since virt-who still can't show error info when failed to start virt-who service. Therefore, reopen it.

[root@hp-z220-05 ~]# rpm -q virt-who
virt-who-0.14-7.el7.noarch

Do the bug's description,then restart virt-who service, it still can't show error info in terminal side. I hope it can show the similar remind info as comment 3.
[root@hp-z220-06 ~]# systemctl restart virt-who

==========It should remind failed to start virt-who=========   
             
[root@hp-z220-06 ~]# 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; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2015-09-06 11:38:36 CST; 24s ago
  Process: 17087 ExecStart=/usr/bin/virt-who (code=exited, status=1/FAILURE)
 Main PID: 17087 (code=exited, status=1/FAILURE)

Sep 06 11:38:36 hp-z220-06.qe.lab.eng.nay.redhat.com systemd[1]: Started Daemon for reporting virtual guest IDs to subscription-manager.
Sep 06 11:38:36 hp-z220-06.qe.lab.eng.nay.redhat.com systemd[1]: Starting Daemon for reporting virtual guest IDs to subscription-manager...
Sep 06 11:38:36 hp-z220-06.qe.lab.eng.nay.redhat.com virt-who[17087]: 2015-09-06 11:38:36,621 ERROR: [Errno 2] No such file or directory: '/var/lib/virt-who/key'
Sep 06 11:38:36 hp-z220-06.qe.lab.eng.nay.redhat.com python[17087]: [Errno 2] No such file or directory: '/var/lib/virt-who/key'
Sep 06 11:38:36 hp-z220-06.qe.lab.eng.nay.redhat.com systemd[1]: virt-who.service: main process exited, code=exited, status=1/FAILURE
Sep 06 11:38:36 hp-z220-06.qe.lab.eng.nay.redhat.com systemd[1]: Unit virt-who.service entered failed state.
Sep 06 11:38:36 hp-z220-06.qe.lab.eng.nay.redhat.com systemd[1]: virt-who.service failed.

Comment 7 Radek Novacek 2015-09-08 10:52:57 UTC
Ah, I forgot to change systemd service type to `notify`.

Comment 8 Radek Novacek 2015-09-15 08:21:32 UTC
*** Bug 1263119 has been marked as a duplicate of this bug. ***

Comment 9 Radek Novacek 2015-09-15 08:54:21 UTC
*** Bug 1263093 has been marked as a duplicate of this bug. ***

Comment 10 Radek Novacek 2015-09-15 15:12:47 UTC
Fixed in virt-who-0.14-8.el7.

Comment 12 Liushihui 2015-09-18 06:07:27 UTC
Verified it virt-who-0.14-8.el7.noarch since virt-who can show error log in terminal side when failed to start virt-who service. Therefore, verify it.

Verified version:
virt-who-0.14-8.el7.noarch
subscription-manager-1.15.9-10.el7.x86_64
python-rhsm-1.15.4-5.el7.x86_64

Verified process:
Case1: If there isn't key, it will show error info after restart virt-who service.
1. Register rhel to Satellite.
2. Configure virt-who with encrypted password, and decrypted password doesn't exist.
[root@hp-z220-06 virt-who.d]# cat /etc/virt-who.d/virt-who
[test-esx1]
type=esx
server=10.66.79.27
username=Administrator
encrypted_password=43f282d679adb816f2bb1cf9c18949ec
owner=ACME_Corporation
env=Library
3. Restart virt-who service
[root@hp-z220-06 virt-who.d]# systemctl start virt-who
Job for virt-who.service failed because the control process exited with error code. See "systemctl status virt-who.service" and "journalctl -xe" for details.
[root@lenovo-x3850-02 ~]# 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; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2015-09-18 01:49:55 EDT; 26s ago
  Process: 78355 ExecStart=/usr/bin/virt-who (code=exited, status=1/FAILURE)
 Main PID: 78355 (code=exited, status=1/FAILURE)
   Status: "virt-who can't be started: [Errno 2] No such file or directory: '/var/lib/virt-who/key'"

Case2: If OWNER or ENV hasn't been configured, it will show error info after restart virt-who.
1. Register system to SAM.
2. Configure virt-who run at esx mode and configure "VIRTWHO_ESX_OWNER" or "VIRTWHO_ESX_ENV" to null.
# grep -v  "^#" /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=5
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=
VIRTWHO_ESX_ENV=Library
VIRTWHO_ESX_SERVER=10.66.78.2
VIRTWHO_ESX_USERNAME=administrator
VIRTWHO_ESX_PASSWORD=qwer1234P!
3. Restart virt-who service and check virt-who's log
[root@hp-z220-05 ~]# systemctl restart virt-who
[root@lenovo-x3850-02 ~]# systemctl restart virt-who
Job for virt-who.service failed because the control process exited with error code. See "systemctl status virt-who.service" and "journalctl -xe" for details.
[root@lenovo-x3850-02 ~]# 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; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2015-09-18 01:55:55 EDT; 43s ago
  Process: 78373 ExecStart=/usr/bin/virt-who (code=exited, status=1/FAILURE)
 Main PID: 78373 (code=exited, status=1/FAILURE)
   Status: "virt-who can't be started: Option --esx-owner (or VIRTWHO_ESX_OWNER environment variable) needs to be set"

Comment 13 errata-xmlrpc 2015-11-19 11:56:30 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-2370.html