libvirt: backport all the cool new stuff, and fix the build against old C libvirt