
On Sat, Jun 4, 2011 at 16:37, Matthias Bolte <matthias.bolte@googlemail.com> wrote:
2011/6/4 Ruben Kerkhof <ruben@rubenkerkhof.com>:
On Sat, Jun 4, 2011 at 10:40, Matthias Bolte <matthias.bolte@googlemail.com> wrote:
Okay VirtualBox 4.0.8 work with libvirt on Windows too. So this seems to be a Solaris specific problem. Does an earlier version of VirtualBox work, for example 4.0.0 or 3.2.10, or did it never work?
I just tried 4.0.0, same behaviour. 3.2.12 does:
ruben@openindiana:~$ virsh list VBoxSVC: error: 0 bytes read from child process error: Failed to reconnect to the hypervisor error: no valid connection error: internal error nsIEventQueue object is null
This is with no running vms, only one which is stopped. I could have a look with gdb, if you can tell me which function I have to set a breakpoint on.
Thanks!
Ruben
Try running with full debug and logging
LIBVIRT_DEBUG=1 LIBVIRT_LOG_OUTPUTS=1:stderr virsh list
and post the output here. I want to verify that the rest is okay and the problem is there where I expect it.
Ok, here it is: ruben@openindiana:~$ LIBVIRT_DEBUG=1 LIBVIRT_LOG_OUTPUTS=1:stderr virsh list 16:57:26.268: 1: info : libvirt version: 0.9.2 16:57:26.268: 1: debug : virInitialize:395 : register drivers 16:57:26.270: 1: debug : virRegisterDriver:750 : driver=fef04f20 name=Test 16:57:26.271: 1: debug : virRegisterDriver:774 : registering Test as driver 0 16:57:26.271: 1: debug : virRegisterNetworkDriver:567 : registering Test as network driver 0 16:57:26.272: 1: debug : virRegisterInterfaceDriver:600 : registering Test as interface driver 0 16:57:26.272: 1: debug : virRegisterStorageDriver:633 : registering Test as storage driver 0 16:57:26.272: 1: debug : virRegisterDeviceMonitor:666 : registering Test as device driver 0 16:57:26.273: 1: debug : virRegisterSecretDriver:699 : registering Test as secret driver 0 16:57:26.273: 1: debug : virRegisterNWFilterDriver:732 : registering Test as network filter driver 0 16:57:26.274: 1: debug : virRegisterDriver:750 : driver=fef051c0 name=Xen 16:57:26.274: 1: debug : virRegisterDriver:774 : registering Xen as driver 1 16:57:26.275: 1: debug : virRegisterDriver:750 : driver=fef00ee0 name=VMWARE 16:57:26.275: 1: debug : virRegisterDriver:774 : registering VMWARE as driver 2 16:57:26.328: 1: debug : tryLoadOne:163 : Found VBoxXPCOMC.so in '/opt/VirtualBox/i386' 16:57:26.329: 1: debug : vboxRegister:94 : VBoxCGlueInit found API version: 3.2.12 (3002012) 16:57:26.329: 1: debug : vboxRegister:116 : VirtualBox API version: 3.2 16:57:26.330: 1: debug : virRegisterDriver:750 : driver=fef05ba0 name=VBOX 16:57:26.331: 1: debug : virRegisterDriver:774 : registering VBOX as driver 3 16:57:26.332: 1: debug : virRegisterNetworkDriver:567 : registering VBOX as network driver 1 16:57:26.332: 1: debug : virRegisterStorageDriver:633 : registering VBOX as storage driver 1 16:57:26.333: 1: debug : virRegisterDriver:750 : driver=fef01820 name=ESX 16:57:26.334: 1: debug : virRegisterDriver:774 : registering ESX as driver 4 16:57:26.334: 1: debug : virRegisterInterfaceDriver:600 : registering ESX as interface driver 1 16:57:26.335: 1: debug : virRegisterNetworkDriver:567 : registering ESX as network driver 2 16:57:26.336: 1: debug : virRegisterStorageDriver:633 : registering ESX as storage driver 2 16:57:26.336: 1: debug : virRegisterDeviceMonitor:666 : registering ESX as device driver 1 16:57:26.336: 1: debug : virRegisterSecretDriver:699 : registering ESX as secret driver 1 16:57:26.337: 1: debug : virRegisterNWFilterDriver:732 : registering ESX as network filter driver 1 16:57:26.337: 1: debug : virRegisterDriver:750 : driver=fef00ca0 name=remote 16:57:26.338: 1: debug : virRegisterDriver:774 : registering remote as driver 5 16:57:26.338: 1: debug : virRegisterNetworkDriver:567 : registering remote as network driver 3 16:57:26.339: 1: debug : virRegisterInterfaceDriver:600 : registering remote as interface driver 2 16:57:26.339: 1: debug : virRegisterStorageDriver:633 : registering remote as storage driver 3 16:57:26.340: 1: debug : virRegisterDeviceMonitor:666 : registering remote as device driver 2 16:57:26.340: 1: debug : virRegisterSecretDriver:699 : registering remote as secret driver 2 16:57:26.341: 1: debug : virRegisterNWFilterDriver:732 : registering remote as network filter driver 2 16:57:26.343: 1: debug : virEventRegisterDefaultImpl:148 : registering default event implementation 16:57:26.344: 1: debug : virEventPollAddHandle:111 : Add handle fd=3 events=1 cb=fec5a5c0 opaque=0 16:57:26.344: 1: debug : virEventPollAddHandle:115 : Used 0 handle slots, adding at least 10 more 16:57:26.345: 1: debug : virEventPollInterruptLocked:686 : Skip interrupt, 0 0 16:57:26.345: 1: debug : virEventRegisterImpl:121 : addHandle=fec5ace0 updateHandle=fec5ac00 removeHandle=fec5aae0 addTimeout=fec5a904 updateTimeout=fec5a7b0 removeTimeout=fec5a6c8 16:57:26.346: 1: debug : virConnectOpenAuth:1327 : name=(null), auth=fef00784, flags=0 16:57:26.349: 1: debug : do_open:1064 : no name, allowing driver auto-select 16:57:26.349: 1: debug : do_open:1101 : trying driver 0 (Test) ... 16:57:26.352: 1: debug : do_open:1107 : driver 0 Test returned DECLINED 16:57:26.352: 1: debug : do_open:1101 : trying driver 1 (Xen) ... 16:57:26.352: 1: debug : do_open:1107 : driver 1 Xen returned DECLINED 16:57:26.352: 1: debug : do_open:1101 : trying driver 2 (VMWARE) ... 16:57:26.356: 1: debug : do_open:1107 : driver 2 VMWARE returned DECLINED 16:57:26.356: 1: debug : do_open:1101 : trying driver 3 (VBOX) ... VBoxSVC: error: 0 bytes read from child process 16:57:57.714: 1: error : vboxInitialize:894 : internal error nsIEventQueue object is null 16:57:58.045: 1: debug : do_open:1107 : driver 3 VBOX returned ERROR 16:57:58.047: 1: debug : virUnrefConnect:145 : unref connection 80a5a18 1 16:57:58.047: 1: debug : virReleaseConnect:94 : release connection 80a5a18 error: Failed to reconnect to the hypervisor error: no valid connection error: internal error nsIEventQueue object is null
What the VirtualBox driver does is dlopen the VBoxXPCOMC.so, get the entry function VBoxGetXPCOMCFunctions and call it, see tryLoadOne in src/vbox/vbox_XPCOMGlue.c. This seems to work otherwise it wouldn't have gotten to the nsIEventQueue error. Then in src/vbox/vbox_tmp.c in vboxInitialize pfnComInitialize is called to initialize the XPCOM interface and get the IVirtualBox and ISession objects. After that it tries to obtain the IEventQueue object and fails because it's NULL. The error reporting order in this function is suboptimal and I'll fix that. Actually it should check the IVirtualBox and ISession object for NULL first because the call to pfnComInitialize probably already failed. But the signature of pfnComInitialize is bad, it should return a value to indicate an error. You also can't tell what the actual problem is because pfnComInitialize internally logs the reason but logging is typically compiled out.
pfnComInitialize points to VBoxComInitialize in src/VBox/Main/cbindings/VBoxXPCOMC.cpp in the VirtualBox source code. Last time I debugged such a problem I ended up compiling VBoxXPCOMC.so from source and replace the system VBoxXPCOMC.so with my own one that just wrote debug messages to a file in /tmp so that I could figure out the actual problem. Last time it was a mismatch in the COM object IDs for the IVirtualBox and ISession objects. libvirt accidentally used the IDs from a beta VirtualBox SDK and the IDs had changed in the actual release. This made the CreateInstanceByContractID calls in VBoxComInitialize fail, and VBoxComUninitialize is called that releases the IEventQueue object and it's NULL when the VirtualBox driver checks it later. So the error message about IEventQueue being NULL is just a symptom of VBoxComInitialize failing.
If we want to fix this we need to figure out why VBoxComInitialize fails. You could try to break on VBoxComInitialize in VBoxXPCOMC.so in gdb. You could also try to make gdb step into the call to VBoxComInitialize in vboxInitialize via pfnComInitialize. I fail at this, maybe it's not even possible.
You're right, I'm not able to step into any VBoxXPCOMC functions: Breakpoint 1, vboxOpen (conn=0x80a5a18, auth=0xfef00784, flags=0) at vbox/vbox_tmpl.c:878 878 data->pFuncs->pfnComInitialize(IVIRTUALBOX_IID_STR, &data->vboxObj, (gdb) s [New LWP 1] [New LWP 2] [New LWP 3] 890 data->pFuncs->pfnGetEventQueue(&data->vboxQueue);
As said last time I compiled my own VBoxXPCOMC.so with debug log output in it to figure out the problem.
Matthias
Ok, I'll look into doing the same. Thanks, Ruben