Ovirt 代码阅读分享

Ovirt 代码阅读分享

1/22 Documents & Tips - Sharing is our passion

Share This Page

  1. pan liyang
    Ovirt 代码阅读分享
    Transcript Header:
    Ovirt 代码阅读分享
    Transcript Body:
    • 1. ovirt code reading share
    • 2. discuss content ● jboss-as ● ovirt-engine-backend ● ovirt-engine-frontend
    • 3. jboss-as
    • 4. ● an application server ● implementing java ee spec ○ JSP (servlet) ○ JAX-RS (rest api) ○ EJB (serve business logic, persistent, transaction) ○ 。。。 ● each spec impl is modular via jboss as configuration file ----------------------------------------------------------------------------------------jboss-as
    • 5. ● jboss as confiuration file ○ server ■ extensions ● extension (define module) ■ profile ● subsystem (module specific configuration) ■ socket-binding-group (bind interface config) ● configuration file is loaded by "jboss-modules" project ----------------------------------------------------------------------------------------jboss-as
    • 6. ovirt 启动 jboss-as ● ./packaging/services/ovirt-engine/ovirt-engine.py start ● 启动 jboss-as: java -D… -jar jboss-modules.jar -xxx -c ovirt-engine.xml ----------------------------------------------------------------------------------------jboss-as
    • 7. ovirt-engine-frontend
    • 8. ● gwt rpc 框架: ------------------------------------------------------------------------ovirt-engine-frontend
    • 9. ● ovirt's implementation: ServiceDefTarget GenericApiGWTServi ceAsync RpcService GenericApiGWTService GenericApiGWTServi ceImpl RpcServlet GWT.create( GenericApiGWTServi ce.class ) ------------------------------------------------------------------------ovirt-engine-frontend
    • 10. -----------------------------------------------------------------------ovirt-engine-frontend GenericApiGWTServiceImpl Backend JNDI GenericApiGWTServiceAsync Frontend VdcOperationManager gwt-rpc
    • 11. ovirt-engine-backend
    • 12. ovirt backend architecture ------------------------------------------------------------------------ovirt-engine-backend Backend (business logic) rest api database vds broker aaa Frontend 。。。
    • 13. ovirt backend logic start from EJB ● 寻找 javax.ejb 内的标签: @Local, @Singleton, @Startup … ● 根据 @DependsOn({ “XXX" }) 先后加载 ● 加载时执行@PostConstruct标注的方法 ● example: ○ Backend.java ○ InitBackendServicesOnStartupBean.java ------------------------------------------------------------------------ovirt-engine-backend
    • 14. Backend business logic Services(EJB) ● AsyncTaskManager ● ResourceManager ● MacPoolManager ● UserDomainsCacheManagerService ● InMemoryLockManager ● ... ------------------------------------------------------------------------ovirt-engine-backend
    • 15. AsyncTaskManager ● what is async task? ○ vdsm commands related to storage actions ○ monitoring tasks from vdsm:"vdsClient -s 0 getAllTasks" ● timely check if task finished ------------------------------------------------------------------------ovirt-engine-backend
    • 16. ResourceManager ● manage cluster ○ schedule update from each vdsm in cluster ● manage storage pool (data center) ○ schedule update from each spm in data center ------------------------------------------------------------------------ovirt-engine-backend
    • 17. InMemoryLockManager ● entry point to acquire command’s lock ● hold all commands’s locks ------------------------------------------------------------------------ovirt-engine-backend
    • 18. ovirt backend Command ● bll command ○ what? take care of a business logic ○ how? interact with DAO(db), backend service, vds command ● vds command ○ simple: invoke vdsm API ------------------------------------------------------------------------ovirt-engine-backend
    • 19. bll command’s basic flow ● canDoAction ● executeCommand ● endAction (may not execute if no task) ------------------------------------------------------------------------ovirt-engine-backend
    • 20. bll command & async task ● invoke vds command that contains async task ● get a task id and hand it to AsyncTaskManager ● endAction() is called when task is done ------------------------------------------------------------------------ovirt-engine-backend
    • 21. bll command & monitoring ● step & job ● monitoring step & job ○ add step/job ○ end step/job ● frontend fetch from db timely ● ------------------------------------------------------------------------ovirt-engine-backend
    • 22. end
    View More