]> xenbits.xensource.com Git - libvirt.git/commit
vbox: change how vbox API is initialized.
authorDawid Zamirski <dzamirski@datto.com>
Wed, 23 Nov 2016 19:01:10 +0000 (14:01 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 23 Nov 2016 19:38:14 +0000 (14:38 -0500)
commit04518c364b726af90d76343105d30b738557f19e
tree37e2f12c4fe819154fe6882a5ed64d838f58818e
parentb270ef99819f0fd02255f1390997d0c2c84793de
vbox: change how vbox API is initialized.

* 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.
src/vbox/vbox_common.c
src/vbox/vbox_driver.c
src/vbox/vbox_tmpl.c
src/vbox/vbox_uniformed_api.h