圖片來源:新浪收藏-抽絲剝繭
使用Opensource 讓人又愛又恨的就是遇到bug和問題,通常到最後只有三種路:
- 回報社群等人修好 (但是通常會等到天荒地老~~~老闆請你來是做啥的!)
- 翻Mail list看以前有沒有人解決過,或有什麼建議 (Hello~~有"沒有人"遇過或修過~~)
- 看source code 然後自己下去patch (我也想當沒有人,但是往往能力不足...Orz..)
話說 Libvirt 雖然有提供Event Registration 的機制和 Java Binding 的Library,但是兩的湊在一起就是不work啊!!
一跑下去就遇到以下錯誤:
libvir: Remote Driver error : adding cb to list exception caught:org.libvirt.LibvirtException: adding cb to list level:VIR_ERR_ERROR code:VIR_ERR_RPC domain:VIR_FROM_REMOTE hasConn:false hasDom:false hasNet:false message:adding cb to list str1:%s str2:adding cb to list str3:null int1:-1 int2:-1一路Trace source code 往下,到了JNA那一層就斷了...囧rz...只好上網看看有沒有人遇到這個問題。
首先看到的就是Redhat 的bug report:
再來 OpenStack 目前也有遇到這個問題:
然後看到有人說要使用Event Registration 前,要先初始化 (不過舉的是C和Python的範例)
Make sure you have registered in the libvirt event loop (or set up your own) before registering for events
最後從Libvirt 的mail 爬出一連串的討論:
- [libvirt] [PATCH] Java bindings for domain events (2008 Nov 07) -->開始討論
- [libvirt] [PATCH 1/2] Java bindings for domain events
- [libvirt] [PATCH 2/2] Java bindings for domain events (2008 Nov 18) -->被打槍
- Re: [libvirt] [PATCH 1/2] Java bindings for domain events (2008 Dec) —>沒下文
- [libvirt-users] Using Java bindings to event callback (2010 Jul) —>沒回應
- [libvirt] [PATCH 0/2] Libvirt-java event handling (2011Jul) —> I think most drivers don't support that. We have a custom driver for our hypervisor and it works.
- [libvirt] [libvirt-java] [PATCH 00/12] event support (2013 Jan)
- [libvirt] [PATCH 2/3] Add event callback implementation based on virConnectDomainEventRegisterAny (2013 Mar)
Ps. 2013 版的那個Patch 有在Github上找到,但是試了一下還是有問題....
所以其實這是一篇碎碎念文,因為結論是目前Java Binding 無法支援這個功能,除非自己跳下去把它改好.....
沒有留言 :
張貼留言