Bug 1095395

Summary: Missing dependency on python-ceilometerclient, combined with erroneous init.d script
Product: [Community] RDO Reporter: leskomw
Component: openstack-ceilometerAssignee: RHOS Maint <rhos-maint>
Status: CLOSED DUPLICATE QA Contact: Shai Revivo <srevivo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: apevec, jruzicka, pbrady, yeylon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-07 17:01:31 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 leskomw 2014-05-07 15:20:21 UTC
Description of problem:

The /usr/bin/ceilometer-agent-compute program has a hard requirement on the python module
python-ceilometerclient:

sudo runuser -s /bin/bash ceilometer -c '/usr/bin/ceilometer-agent-compute --logfile /var/log/ceilometer/compute.log '
Traceback (most recent call last):
  File "/usr/bin/ceilometer-agent-compute", line 6, in <module>
    from ceilometer.cli import agent_compute
  File "/usr/lib/python2.6/site-packages/ceilometer/cli.py", line 33, in <module>
    from ceilometer.alarm import service as alarm_service
  File "/usr/lib/python2.6/site-packages/ceilometer/alarm/service.py", line 23, in <module>
    from ceilometerclient import client as ceiloclient
ImportError: No module named ceilometerclient

This fails to start via the typical service command, but the command is *recorded* as
successful, thus cluttering up /var/lock/subsys & /var/run/ceilometer/*.pid:

$ sudo service openstack-ceilometer-compute start ; echo $?
Starting openstack-ceilometer-compute:                     [  OK  ]
0
$ sudo service openstack-ceilometer-compute status ; echo $?
openstack-ceilometer-compute dead but pid file exists
1

That's because on line 34 of /etc/init.d/openstack-ceilometer-compute:

34    daemon --user ceilometer --pidfile $pidfile "$exec --logfile $logfile &>/dev/null & echo \$! > $pidfile"

The command *always* returns 0, since the final command, echo $! returns 0. So the 
retval check at line 37 "succeeds".

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

openstack-ceilometer-compute-2014.1-1.el6.noarch

How reproducible:

Always, IF python-cielometerclient is not installed otherwise (puppet-openstack modules may do this).

Steps to Reproduce:
1. rpm -e openstack-ceilometer-compute python-ceilometerclient
2. yum install -y openstack-ceilometer-compute
3. service openstack-ceilometer-compute start
4. service openstack-ceilometer-compute status

Actual results:

$ service openstack-ceilometer-compute status ; echo $?
openstack-ceilometer-compute dead but pid file exists
1

Expected results:

openstack-ceilometer (pid  12345) is running...

Additional info:

It looks like *all* of the /etc/init.d/openstack-* files use the construct:

daemon --user SERVICE--pidfile $pidfile "$exec &>/dev/null & echo \$! > $pidfile"

which is always going to return 0 from the final echo. Why is the pidfile being
created twice? Does the --pidfile option not work?

Proposed solution is to add a:

Requires: python-ceilometerclient

to %package compute

or, arguably, to python-ceilometer, which is the owner of:

$ rpm -qf /usr/lib/python2.6/site-packages/ceilometer/alarm/service.py
python-ceilometer-2014.1-1.el6.noarch

Comment 1 Pádraig Brady 2014-05-07 17:01:31 UTC
All valid points.

The init script aspect is covered in bug 1094940

The dependencies issue will be considered in bug 1095414

so closing this

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

Comment 2 Alan Pevec 2014-05-08 11:09:10 UTC
> Does the --pidfile option not work?

deamon function does not create pidfile, daemonized process itself must create it and initscript use it as an indication process has started successfully.

This has been fixed in some el6 initscripts[1] with a wrapper using systemd style notification and will be deployed to ceilometer in bug 1094940

[1] e.g. http://pkgs.fedoraproject.org/cgit/openstack-keystone.git/tree/openstack-keystone.init?h=el6-icehouse#n30