• D
    vbox: change how vbox API is initialized. · 04518c36
    Dawid Zamirski 提交于
    * add vboxDriver object to serve as a singleton global object that
      holds references to IVirtualBox and ISession to be shared among
      multiple connections. The vbox_driver is instantiated only once in
      the first call vboxGetDriverConnection function that is guarded by
      a mutex.
    
    * call vbox API initialize only when the first connection is
      established, and likewise uninitialize when last connection
      disconnects. The prevents each subsequent connection from overwriting
      IVirtualBox/ISession instances of any other active connection that
      led to libvirtd segfaults. The virConnectOpen and virConnectClose
      implementations are guarded by mutex on the global vbox_driver_lock
      where the global vbox_driver object counts connectios and decides
      when it's safe to call vbox's init/uninit routines.
    
    * add IVirutalBoxClient to vboxDriver and use it to in tandem with newer
      pfnClientInitialize/pfnClientUninitalize APIs for vbox versions that
      support it, to avoid usage of the old pfnComInitialize/Uninitialize.
    04518c36
vbox_tmpl.c 169.0 KB