Skip to contentSkip to conversation

about Xen API's 'api' attribute

DISCUSSION Yanjun Wu 1 participant 1 message Dec 6, 2008

lore
Share & tools
lore

Yanjun Wu

author
#0 lore raw

when reading the following code, the line marked with * calls hasattr(meth, 'api').
But I cannot find where 'api' attribute is set to the method after searching the whole directory.
And also, what kind of typical methods are in self.xenapi? I traced to Unix PAM, then get stucked. thanks.

================
tools/python/xen/xend/server/XMLRPCServer.py : line 171
----------------
# Register Xen API Functions
# exportable functions are ones that do not begin with '_' # and has the 'api' attribute.

for meth_name in dir(self.xenapi):
if meth_name[0] != '_':
meth = getattr(self.xenapi, meth_name)
* if callable(meth) and hasattr(meth, 'api'):
self.server.register_function(meth, getattr(meth,
'api'))
================