于 2012年06月21日 03:10, Adam Litke 写道:
On Wed, Jun 20, 2012 at 06:08:57PM +0800, Xu He Jie wrote:
I am trying move api implement to sub-module, then we don't need
singleton and passing clientif to anywhere. So I sent this mail to
descript the idea. I think it's good for review.
So I add api registeration mechanism. Other modules can register
it's api implement to api layer.
I try to move VM api and vm stuff(like clientif.vmContainer, etc) to
a new module called vmm. the vmm.VMM is similar with hsm. It's
responsiable for managing vm and register VM implement to api layer.
Same with hsm, I move all storage related api to hsm, and hsm will
register them to api layer.
After all api move to submodule, we can rename clientif and
needn't passing client to any where. :)
I have already submit a rough version to gerrit:
I took a cursory look at the code you have submitted. I think you need to more
thoroughly describe your design. I was particularly confused by your use of
Abstract Base Classes for this scenario. Can you explain in more depth why you
have done this? Is there a simpler way to accomplish what you need to do? I
looked at your VMM patch and I am unsure why you need to define VMBase and
VMImpl separately. It means declaring the set of functions in two separate
files. Thanks for shining some more light on your methodology.
Adam, Thanks for reply!
I want to force people declare their API interface before they implement
it. the vdsm API should be
standard, stable, it won't be modified frequently. And anyone should
implement the API as the definition.
So I added Abstract Base Classes. The API interface must be declared at
API.py, then people must
implement as the API.py defined.
I think it more clear for people want to implement the vdsm API. People
can find the API definition from
API.py and implement it as the interface definition.
As example, VMBase is the vdsm VM API interface definition in API.py.
VMBase is an Abstract Base Class.
so VMImpl is an implement of VM API. When I register VMImpl to API layer
by the function 'API.registAPI()'.
'API.registAPI()' will check VMImpl to ensure VMImpl implement VM API as
definition of VMBase in API.py.
If we didn't define API interface, so people will confuse what is vdsm
API looks like and which implement of
API is standard.
vdsm-devel mailing list