[Openstack] Question about recent log-related changes

Vladimir Popovski vladimir at zadarastorage.com
Mon Aug 8 23:29:41 UTC 2011


Hi Josh,



I have a question regarding latest changes that were introduced for log file
settings. It seems like now log.py is trying to change mode of log files
using:



                os.chmod(self.logpath, FLAGS.logfile_mode)



I’m completely fine with it for all modules except nova-manage… It is
required to start nova-manage as a superuser even for “read” type of
operations (otherwise it fails with following)



Traceback (most recent call last):

  File "bin/nova-manage", line 1819, in <module>

    main()

  File "bin/nova-manage", line 1759, in main

    logging.setup()

  File "/home/vlad/cactus/vsa/nova/nova/log.py", line 298, in setup

    logging.root = NovaRootLogger("nova")

  File "/home/vlad/cactus/vsa/nova/nova/log.py", line 242, in __init__

    NovaLogger.__init__(self, name, level)

  File "/home/vlad/cactus/vsa/nova/nova/log.py", line 137, in __init__

    self.setup_from_flags()

  File "/home/vlad/cactus/vsa/nova/nova/log.py", line 260, in
setup_from_flags

    os.chmod(self.logpath, FLAGS.logfile_mode)

OSError: [Errno 1] Operation not permitted: '/var/log/nova/nova-manage.log'





One of possible workarounds might be to issue chmod only if log’s file mode
is different from requested one. Something like that may work:



                import stat



                st = os.stat(self.logpath)

                if st.st_mode != (stat.S_IFREG | FLAGS.logfile_mode):

                    os.chmod(self.logpath, FLAGS.logfile_mode)



Am I missing anything?



Thanks,

-Vladimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20110808/7d7cf747/attachment.html>


More information about the Openstack mailing list