Keystone项目的主要目的是给整个openstack的各个组件(项目)提供一个统一的验证方式。用户管理,身份验证是几乎所有的软件管理都要处理的问题,Keystone对于通常的应用场景所不同的是他要解决分布式环境下的统一认证。
Keystone的程序结构也是采用openstack通常所用的manager,driver方式,这中方式的一个好处是driver可以被灵活的替换,通过配置的方式动态替换。Keystone 的实现方式同其他openstack项目不太一样的是,他使用了了一个python语言的特性
def__getattr__(self, name):
"""Forward calls to theunderlying driver."""
# NOTE(termie): context is the firstargument, we're going to strip
# that for now, in the futurewe'll probably do some
# logging and whatnot in thisclass
f = getattr(self.driver, name)
@functools.wraps(f)
def _wrapper(context, *args, **kw):
return f(*args, **kw)
setattr(self, name, _wrapp