[libvirt] Host device assignment driver name vfio/ kvm

Laine Stump laine at laine.org
Thu Mar 31 16:07:04 UTC 2016


On 03/31/2016 11:58 AM, Moshe Levi wrote:
>
> Thanks Laine,
>
> Adding  the driver_name o the config did the trick,  thanks J
>
> Regarding the vifo error it seem that openstack does roleback if 
> operation failed so that why you see the virDomainAttachDeviceFlags
>
> Anyhow I found that the in qemu 2.1 suspend is not working (I got 
> error [1] )  so I upgrade to qemu 2.5 and then suspend work but it 
> failed on resume.
>
> So Just to clarify vfio is not supporting “attach device” right?  is 
> qemu going to support it?
>

Not at all. attach device works just fine with vfio (that's how hotplug 
is done). I've just been using it myself in some testing. (note that 
vfio has been supported since kernel 3.6 and libvirt 1.0.5, i.e. a "very 
long time")


> Now I wonder if I need to hardcode in the hostdev config to be with 
> driver_name=kvm…
>


I certainly hope not. You would be viciously attacked by the keeper of 
vfio for your transgression! :-)

Seriously, there should be no reason whatsoever to force driver 
name='kvm'. This was made configurable *only* as a fallback in case 
errors were encountered with vfio during its early days. As a matter of 
fact, I'm pretty sure that RHEL7 has legacy kvm device assignment 
completely disabled. If you are needing to force legacy kvm device 
assignment to make your setup work, then there is a bug somewhere that 
needs to be investigated and squashed.



> [1] -ERROR:qom/object.c:725:object_unref: assertion failed: (obj->ref > 0)
>
> *From:*sendmail [mailto:justsendmailnothingelse at gmail.com] *On Behalf 
> Of *Laine Stump
> *Sent:* Wednesday, March 30, 2016 9:25 PM
> *To:* Libvirt <libvir-list at redhat.com>
> *Cc:* Moshe Levi <moshele at mellanox.com>
> *Subject:* Re: [libvirt] Host device assignment driver name vfio/ kvm
>
> On 03/29/2016 07:45 AM, Moshe Levi wrote:
>
>     Hi,
>
>     I was  testing Host device assignment  in OpenStack environment
>     where the driver name is vfio or kvm.
>
>     My setup is as follow:
>
>     1.Fedora 21
>
>     2.Libvirt 1.3.0 which I compiled
>
>     3.OpenStack master
>
>     I have also other setups with older Libvirt version and the same
>     OpenStack environment.
>
>     I notice that on my fedora environment the driver name is vfio
>     were in my old environment the driver name is kvm.
>
>     According to Libvirt documentation default is "vfio" on systems
>     where the VFIO driver is available and loaded, see [1]
>
>     I remove the vfio modules by removing vfio, vfio_iommu_type1,
>     vfio_pci but when I boot a vm the drive name is vfio
>
>     How can change the driver name to be kvm?
>
>
> libvirt tries very hard to use vfio rather than legacy kvm, because 
> legacy kvm is old, deprecated, and "declared bad" :-). But it won't 
> changed it to vfio if you've explicitly said that you want to use kvm. 
> If you really want to use legacy kvm device assignment, manually set 
> that in the config. When you do that, if the system you're running on 
> doesn't support it, it will error out rather than switching.
>
>     Another thing that I encounter is an error when suspending VM (in
>     OpenStack environment)  when the driver name is  vfio.
>
>     In such case I am getting  the following error from Libvirt:
>
>     2016-03-28 11:42:59.527 1966 ERROR oslo_messaging.rpc.dispatcher  
>     File "/usr/lib64/python2.7/site-packages/libvirt.py", line 560, in
>     attachDeviceFlags
>
>     2016-03-28 11:42:59.527 1966 ERROR
>     oslo_messaging.rpc.dispatcher     if ret == -1: raise libvirtError
>     ('virDomainAttachDeviceFlags() failed', dom=self)
>
>     2016-03-28 11:42:59.527 1966 ERROR oslo_messaging.rpc.dispatcher
>     libvirtError: internal error: unable to execute QEMU command
>     'device_add': Device initialization failed.
>
>     I would appreciate for some pointers on what can cause this issue.
>
>
> Assuming that openstack uses libvirt's virDomainSave API I would 
> expect suspending a guest to fail if it had an assigned device (since 
> libvirt implements this by "migrating to disk", and qemu doesn't allow 
> migration of a guest with an assigned device. But your problem is that 
> it's trying to *attach* a device, which I wouldn't consider to be a 
> part of a save or suspend or whatever operation. Is it possible to get 
> more information about what leads up to this?
>
>
>
>     [1] https://libvirt.org/formatdomain.html#elementsHostDev
>     <https://libvirt.org/formatdomain.html#elementsHostDev>
>
>
>
>
>     --
>
>     libvir-list mailing list
>
>     libvir-list at redhat.com <mailto:libvir-list at redhat.com>
>
>     https://www.redhat.com/mailman/listinfo/libvir-list
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160331/b0528c8b/attachment-0001.htm>


More information about the libvir-list mailing list