← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1065430] Re: If the log directory is not present then nova-api should fail to write the log messages

 

Actually, I went back and had another poke at this and I think the
current behaviour is reasonable. Here's an example:

mikal@xen:/opt/stack/nova$ grep log /etc/nova/nova.conf 
logging_context_format_string = %(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s
logdir = /var/log/nova

mikal@xen:/opt/stack/nova$ ls -l /var/log/nova
ls: cannot access /var/log/nova: No such file or directory

mikal@xen:/opt/stack/nova$ cd /opt/stack/nova && /opt/stack/nova/bin/nova-api || touch "/opt/stack/status/stack/n-api.failure"
Traceback (most recent call last):
  File "/opt/stack/nova/bin/nova-api", line 51, in <module>
    logging.setup("nova")
  File "/opt/stack/nova/nova/openstack/common/log.py", line 331, in setup
    _setup_logging_from_conf(product_name)
  File "/opt/stack/nova/nova/openstack/common/log.py", line 378, in _setup_logging_from_conf
    filelog = logging.handlers.WatchedFileHandler(logpath)
  File "/usr/lib/python2.7/logging/handlers.py", line 394, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 901, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 924, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 2] No such file or directory: '/var/log/nova/nova-api.log'

So, nova-api does refuse to start if the log directory is missing. I'm
going to abandon my review and declare this not a bug unless anyone else
has thoughts on this.

** Changed in: oslo
       Status: In Progress => Invalid

** Changed in: nova
       Status: Triaged => Won't Fix

** Changed in: nova
     Assignee: Michael Still (mikalstill) => (unassigned)

** Changed in: oslo
     Assignee: Michael Still (mikalstill) => (unassigned)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1065430

Title:
  If the log directory is not present then nova-api should fail to write
  the log messages

Status in OpenStack Compute (Nova):
  Won't Fix
Status in Oslo - a Library of Common OpenStack Code:
  Invalid

Bug description:
  Expected:
  If the /var/log/nova directory is deleted then nova loggers should fail and nova-api return with HTTP 500 and request should not proceed further.

  Current:
  If the /var/log/nova/ directory is deleted then the logs are not written to nova-api.log file but the request is processed further. And the python-wsgi logs are failing with HTTP 400.

  Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/greenpool.py", line 80, in _spawn_n_impl
  func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 514, in process_request
  proto = self.protocol(socket, address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 638, in _init_
  self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
  self.handle_one_request()
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 232, in handle_one_request
  self.handle_one_response()
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 393, in handle_one_response
  wall_seconds=finish - start))
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 518, in log_message
  self.log.write(message + '\n')
  File "/usr/lib/python2.7/dist-packages/nova/openstack/common/log.py", line 380, in write
  self.logger.log(self.level, msg)
  File "/usr/lib/python2.7/logging/_init_.py", line 1461, in log
  self.logger.log(level, msg, *args, **kwargs)
  File "/usr/lib/python2.7/logging/_init_.py", line 1203, in log
  self._log(level, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/_init_.py", line 1258, in _log
  self.handle(record)
  File "/usr/lib/python2.7/logging/_init_.py", line 1268, in handle
  self.callHandlers(record)
  File "/usr/lib/python2.7/logging/_init_.py", line 1308, in callHandlers
  hdlr.handle(record)
  File "/usr/lib/python2.7/logging/_init_.py", line 748, in handle
  self.emit(record)
  File "/usr/lib/python2.7/logging/handlers.py", line 408, in emit
  self.stream.flush()
  ValueError: I/O operation on closed file

  root@nova-in-a-box:/usr/share/pyshared# nova list
  ------------------------------------------------------------------------------------+
  ID 	Name 	Status 	Networks

  ------------------------------------------------------------------------------------+
  4854e498-bcce-49d0-8a93-753c023e6f72 	at_boot_test 	ACTIVE 	private=10.10.0.2, 10.30.0.1

  ------------------------------------------------------------------------------------+
  root@nova-in-a-box:/usr/share/pyshared# mv /var/log/nova/ /var/log/nova_bck
  root@nova-in-a-box:/usr/share/pyshared# nova list
  ERROR: n/a (HTTP 400)

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1065430/+subscriptions