[libvirt] [RFC PATCH 0/3] Implement two-tier driver loading

Adam Walters adam at pandorasboxen.com
Sat Dec 21 04:14:41 UTC 2013


This patchset implements a two-tier driver loading system. I split the hypervisor drivers out into their own tier, which is loaded after the other drivers. This has the net effect of ensuring that things like secrets, networks, etc., are initialized and auto-started before any hypervisors, such as qemu, lxc, etc., are touched. This resolves the race condition present when starting libvirtd while domains are running, which happens when restarting libvirtd after having started at least one domain.

This patch will work without my config driver patchset, but does prevent RBD storage pools from auto-starting. It may also affect other pool types, but I only have file and RBD to test with, personally. The RBD storage pool is only affected because it requires a hypervisor connection (prior to this patchset, that connection was hardcoded to be a connection to qemu on localhost) in order to look up secrets. Any pool type that does not use/need data outside of the base storage pool definition should continue to auto-start (file backed pools definitely still work) and also no longer be part of the restart race condition.

For anyone who is not familiar with the race condition I mentioned above, the basic description is the upon restarting libvirtd, any running QEMU domains using storage pool backed disks are killed (randomly) due to their storage pool not being online. This is due to storage pool auto-start not having finished before QEMU initalization runs.


I would appreciate any comments and suggestions about this patchset. It works for me on 4 machines running three different distros of Linux (Archlinux, Gentoo, and CentOS), so I would imagine it should work most anywhere.

Adam Walters (3):
  driver: Implement new state driver field
  storage: Fix hardcoded qemu connection
  libvirt: Implement two-tier driver loading

 src/config/config_driver.c              |  1 +
 src/driver.h                            |  6 ++++
 src/interface/interface_backend_netcf.c |  1 +
 src/libvirt.c                           | 57 ++++++++++++++++++++++++++++-----
 src/libxl/libxl_driver.c                |  1 +
 src/lxc/lxc_driver.c                    |  1 +
 src/network/bridge_driver.c             |  1 +
 src/node_device/node_device_hal.c       |  1 +
 src/node_device/node_device_udev.c      |  1 +
 src/nwfilter/nwfilter_driver.c          |  1 +
 src/qemu/qemu_driver.c                  |  1 +
 src/remote/remote_driver.c              |  1 +
 src/secret/secret_driver.c              |  1 +
 src/storage/storage_driver.c            | 13 ++++----
 src/uml/uml_driver.c                    |  1 +
 src/xen/xen_driver.c                    |  1 +
 16 files changed, 75 insertions(+), 14 deletions(-)

-- 
1.8.5.2




More information about the libvir-list mailing list