On Fri, 2018-09-14 at 15:01 +0200, Jiri Denemark wrote: > On Fri, Sep 14, 2018 at 10:35:58 +0200, Andrea Bolognani wrote: > > There are a few cases in which we're not reporting the correct > > information through 'virsh capabilities', leading to applications > > such as libguestfs attempting to launch KVM guests on a host that > > doesn't actually support them. > > > > Our code is also more complicated than it needs to be due to > > backwards compatibilty reasons that we no longer care about these > > days, so we can perform some cleanup there; there are further > > cleanup opportunities in the same area, but some of them are a > > bit tricky so I'll leave them for a follow-up series. > > > > We also get some extra test coverage pretty much for free. Yay! > > So this makes things cleaner and fixes KVM reporting in capabilities. > > But we also check /dev/kvm in virQEMUCapsIsValid. Which means we may > reprobe QEMU everytime in case the kvm module is not loaded (but > /dev/kvm exists)
We can try poking harder at /dev/kvm, eg. open() it, run some ioctl()s on it or whatever is necessary to figure out whether the device is actually functional rather than just showing up. However, that would mean duplicating some work that QEMU can already do for us, so I'm not too fond of it. It also feels a bit too ad-hoc. How ridiculous would it be to invalidate capabilities whenever the daemon is restarted? That might strike a somewhat reasonable balance between requiring the admin to delete a bunch of internal files after configuring the system to load the KVM module and re-probing QEMU all the time. > and we will never catch the case when kvm module was > loaded originally, but the admin unloads it while libvirtd is running. > Although this series doesn't make it any worse. Is there a concrete use case for that? It doesn't look like a situation that we should really concern ourselves with. > > qemu: Drop QEMU_CAPS_ENABLE_KVM > > After removing this capability it looks like virQEMUCapsIsValid will > always invalidate every single non-native QEMU binary since kvm could > not clearly be used when probing and /dev/kvm is present. Shouldn't we > add a check which makes sure we don't go this far for non-native > binaries? We can use virQEMUCapsGuestIsNative() and skip all KVM-related checks for non-native binaries. Does that sound okay? -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list