crontab entry glance-cache-pruner
Environment
Red Hat OpenStack 6.0
Issue
Issues with glance-cache filling the root filesystem, resolved by creating glance crontab. If glance-cache-pruner is executed manually prior to cronjob, /var/log/glance/image-cache.log is created with wrong owner root:root and cronjob fails to clean the filesystem.
Disk usage is increasing. Solution is to implement glance-cache-pruner job.
crontab -l -u glance
*/30 * * * * /usr/bin/glance-cache-pruner
It appears that the cron jobs are not being run, despite cron logging that they are.
Example:
[root@xxx]# grep glance /var/log/cron
Oct 12 13:00:00 xxx CROND[5213]:(glance) CMD (glance-cache-pruner)
[root@xxx ~]#
[root@xxx ~]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root 278G 199G 79G 72% /
Resolution
Check /var/log/glance/image-cache.log.
ls -l /var/log/glance/image-cache.log.
-rw-r--r--. 1 root root 2716 Oct 12 13:37 /var/log/glance/image-cache.log
chown glance:glance /var/log/glance/image-cache.log
Root Cause
Wrong owner on /var/log/glance/image-cache.log.
Diagnostic Steps
touch /tmp/glance-cron.log
chmod o+w /tmp/glance-cron.log
crontab -l -u glance
*/30 * * * * /usr/bin/glance-cache-pruner --debug --verbose >> /tmp/glance-cron.log 2>&1
cat /tmp/glance-cron.log
Traceback (most recent call last):
File "/usr/bin/glance-cache-pruner", line 10, in
sys.exit(main())
File "/usr/lib/python2.7/site-packages/glance/cmd/cache_pruner.py", line 43, in main
log.setup('glance')
File "/usr/lib/python2.7/site-packages/glance/openstack/common/log.py", line 460, in setup
_setup_logging_from_conf(product_name, version)
File "/usr/lib/python2.7/site-packages/glance/openstack/common/log.py", line 529, in _setup_logging_from_conf
filelog = logging.handlers.WatchedFileHandler(logpath)
File "/usr/lib64/python2.7/logging/handlers.py", line 392, in init
logging.FileHandler.init(self, filename, mode, encoding, delay)
File "/usr/lib64/python2.7/logging/init.py", line 902, in init
StreamHandler.init(self, self._open())
File "/usr/lib64/python2.7/logging/init.py", line 925, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/glance/image-cache.log'
[root@xxx ~]# ls -l /var/log/glance/image-cache.log
-rw-r--r--. 1 root root 282 Oct 12 13:37 /var/log/glance/image-cache.log
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments