Glance-api fails to start in docker

Bug #1587185 reported by Marek Celoud on 2016-05-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstack-salt
High
Filip Pytloun

Bug Description

Glance-api container starts with default log file /var/log/glance/api.log which has default permissions root:root so it fails.

starting glance-api
Traceback (most recent call last):
  File "/usr/bin/glance-api", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/dist-packages/glance/cmd/api.py", line 75, in main
    logging.setup(CONF, 'glance')
  File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 211, in setup
    _setup_logging_from_conf(conf, product_name, version)
  File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 263, in _setup_logging_from_conf
    filelog = logging.handlers.WatchedFileHandler(logpath)
  File "/usr/lib/python2.7/logging/handlers.py", line 391, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 903, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 928, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/glance/api.log'

Workaround:
https://github.com/pupapaik/salt-formula-glance/commit/dd550be3877609f8e24d5121885a74ff3520093a

Changed in openstack-salt:
importance: Undecided → High
assignee: nobody → Filip Pytloun (fpytloun)
Revision history for this message
Filip Pytloun (fpytloun) wrote :

It shouldn't use logs at all but stdout.

Revision history for this message
Marek Celoud (marek-celoud) wrote :

OpenStack services logs on stdout as well as into log file (log_file = /var/log/glance/api.log in glance-api.conf). However we want to log all services into /var/log too. It will use host volume.

Should we leave it in dockerfile or extend salt formula glance?

Revision history for this message
Filip Pytloun (fpytloun) wrote :

I would prefer forcing services to use stdout and disable useless file-based logging.

Then it's possible to collect logs from containers for example this way:
https://hekad.readthedocs.io/en/v0.10.0/config/inputs/docker_log.html

Anyway there's no need to have volume on /var/log and file-based logs when it's correctly dockerized.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to salt-formula-glance (master)

Reviewed: https://review.openstack.org/324290
Committed: https://git.openstack.org/cgit/openstack/salt-formula-glance/commit/?id=3c5ce1c69de3d0bee9789c7b14edfddc3662426e
Submitter: Jenkins
Branch: master

commit 3c5ce1c69de3d0bee9789c7b14edfddc3662426e
Author: Jakub Pavlik <email address hidden>
Date: Mon May 30 23:23:31 2016 +0200

    fix for glance api log

    Change-Id: If4b60a164f5601e54878e3201589a04407b46620
    Closes-Bug: #1587185

Changed in openstack-salt:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers