Bug 1011981 - `service libvirt-guests status` may return 0 even if stopped
`service libvirt-guests status` may return 0 even if stopped
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.4
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Jiri Denemark
Virtualization Bugs
infra
: ZStream
: 957779 (view as bug list)
Depends On:
Blocks: 1010693 1017196
  Show dependency treegraph
 
Reported: 2013-09-25 09:39 EDT by Dan Kenigsberg
Modified: 2013-11-21 04:11 EST (History)
18 users (show)

See Also:
Fixed In Version: libvirt-0.10.2-28.el6
Doc Type: Bug Fix
Doc Text:
Whereas the status command of libvirt-guests init script returned "0" value when libvirt-guests service was stopped, LSB (Linux Standard Base) required a different value ("3") in such case. Consequently, other scripts relying on the return value could not distinguish whether the service was running or not. The libvirt-guests script has been fixed to conform with LSB and the "service libvirt-guests status" command now returns the correct value in the described scenario.
Story Points: ---
Clone Of: 1010693
Environment:
Last Closed: 2013-11-21 04:11:13 EST
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)

  None (edit)
Description Dan Kenigsberg 2013-09-25 09:39:42 EDT
+++ This bug was initially created as a clone of Bug #1010693 +++

Description of problem:

When starting vdsmd service, the service ask for authentication name and password and passwords and then wait for ever for input.

Version-Release number of selected component (if applicable):

host: RHEL 6.4
libvirt: 0.10.2-18.el6_4.14.x86_64
vdsm: 1b9acee00ff12d

How reproducible:
Always

Steps to Reproduce:
1. Install vdsm 4.12.1 from ovirt stable repository
   http://resources.ovirt.org/releases/stable/rpm/EL/6/x86_64/
2. Start few vms from ovirt engine
3. yum remove vdsm*
4. Build vdsm from source and perfom basic installation
   cd ~/rpmbuild/RPMS 
   yum install --enablerepo=ovirt-beta x86_64/* noarch/vdsm-xml* noarch/vdsm-cli*
5. service vdsmd stop
6. service vdsmd start (vdsm fail to connect to libvirt)
7. service vdsmd stop
8. service vdsmd start (some warnings)
9. service vdsmd stop
10. service vdsmd start

Actual results:
vdsm ask for password and wait for input

Expected results:
start without waiting for input

Additional info:

The "Please enter authentiction name" messages comes from libvirt. We get the same message when running "virsh list".

From this point vdsmd always ask for password when starting the service.

....

[root@dhcp-2-233 RPMS]# service vdsmd start

Can't connect to default. Skipping.
libvirtd start/running, process 12872
vdsm: Running run_init_hooks
vdsm: Running gencerts
vdsm: Running reconfigure_sanlock
vdsm: Running reconfigure_libvirt
libvirt is already configured for vdsm
vdsm: Running syslog_available
vdsm: Running nwfilter
libvir: Network Filter Driver error : Requested operation is not valid: nwfilter is in use
vdsm: Running dummybr
vdsm: Running load_needed_modules
vdsm: Running tune_system
vdsm: Running mkdirs
vdsm: Running test_space
vdsm: Running test_lo
vdsm: Running test_conflicting_conf
SUCCESS: ssl configured to true. No conflicts
Starting up vdsm daemon: 
vdsm start                                                 [  OK  ]
[root@dhcp-2-233 RPMS]# service vdsmd stop
Shutting down vdsm daemon: 
vdsm watchdog stop                                         [  OK  ]
vdsm: Running run_final_hooks                              [  OK  ]
vdsm stop                                                  [  OK  ]
[root@dhcp-2-233 RPMS]# service vdsmd start
Please enter your authentication name: Please enter your password:

--- Additional comment from Nir Soffer on 2013-09-22 17:19:40 IST ---

Entering empty password, vdsmd service starts:

...
Please enter your authentication name: Please enter your password:

Can't connect to default. Skipping.
initctl: Job is already running: libvirtd
vdsm: Running run_init_hooks
vdsm: Running gencerts
vdsm: Running reconfigure_sanlock
vdsm: Running reconfigure_libvirt
libvirt is already configured for vdsm
vdsm: Running syslog_available
vdsm: Running nwfilter
libvir: Network Filter Driver error : Requested operation is not valid: nwfilter is in use
vdsm: Running dummybr
vdsm: Running load_needed_modules
vdsm: Running tune_system
vdsm: Running mkdirs
vdsm: Running test_space
vdsm: Running test_lo
vdsm: Running test_conflicting_conf
SUCCESS: ssl configured to true. No conflicts
Starting up vdsm daemon: 
vdsm start                                                 [  OK  ]


From the engine side, the host seems to function correctly. The vms can be stopped and started again.

--- Additional comment from Dan Kenigsberg on 2013-09-25 15:35:01 IST ---

The problem is real, due to

# service libvirt-guests status; echo $?
stopped, with no saved guests
0

returning a wrong $? == 0 even when it is stopped (should be 3)

The issue is solved in upstream libvirt by virtue of

commit 9c51de2b4e2158b93adab4467293b35626099ff6
Author: Ján Tomko <jtomko@redhat.com>
Date:   Tue Apr 30 13:44:33 2013 +0200

    libvirt-guests: status: return non-zero when stopped


Note: the issue is hidden if somehow there were saved guests such as in
# service libvirt-guests status; echo $?
stopped, with saved guests
3
Comment 2 Jiri Denemark 2013-09-30 09:13:48 EDT
*** Bug 957779 has been marked as a duplicate of this bug. ***
Comment 4 Hu Jianwei 2013-10-08 06:08:35 EDT
I can reproduce this bug with libvirt-0.10.2-27.el6.x86_64, but can not reproduce it with libvirt-0.10.2-28.el6.x86_64

Reproducing:
[root@hp-dl385g7-01 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 6     r6                             running
 -     rhel6                          shut off

[root@hp-dl385g7-01 ~]# virsh destroy r6
Domain r6 destroyed

[root@hp-dl385g7-01 ~]# service libvirt-guests status
started
[root@hp-dl385g7-01 ~]# service libvirt-guests stop

Running guests on default URI: no running guests.

[root@hp-dl385g7-01 ~]# service libvirt-guests status
stopped, with no saved guests
[root@hp-dl385g7-01 ~]# echo $?
0
[root@hp-dl385g7-01 ~]#

Verifing:
[root@hp-dl385g7-01 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     r6                             shut off
 -     rhel6                          shut off

[root@hp-dl385g7-01 ~]# service libvirt-guests start
[root@hp-dl385g7-01 ~]# service libvirt-guests status
started
[root@hp-dl385g7-01 ~]# service libvirt-guests stop

Running guests on default URI: no running guests.

[root@hp-dl385g7-01 ~]# service libvirt-guests status
stopped, with no saved guests
[root@hp-dl385g7-01 ~]# echo $?
3
[root@hp-dl385g7-01 ~]#
Comment 8 Hu Jianwei 2013-10-09 06:10:15 EDT
Changed to verified according to comment 4.
Comment 11 errata-xmlrpc 2013-11-21 04:11:13 EST
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-2013-1581.html

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