标签:
实现nova-api调用的filter,将调用记录保存到本地文件中和保存到数据库中
killall nova-api
nova/api/openstack/compute/customs.py
from nova import wsgi as base_wsgi import webob.dec from oslo_log import log as logging from nova.api.openstack import wsgi LOG = logging.getLogger(__name__) class RecordsMiddleware(base_wsgi.Middleware): def __init__(self,application): base_wsgi.Middleware.__init__(self,application) @webob.dec.wsgify(RequestClass=wsgi.Request) def __call__(self,req): file = open(‘/home/stack/customs/records‘,‘a‘) record = req.path_info + ‘\n‘ #LOG file.write(record) file.close() return self.application
/etc/nova/api-paste.ini
1、增加filter
2、把filter添加到composit的keystone pipeline下
nova-api
查看~/stack/coutoms/record
标签:
原文地址:http://www.cnblogs.com/yippee/p/4520431.html