libvirt:driver:Disallow AIO=native when 'O_DIRECT' is not available
Because of the libvirt issue[1], there is a bug[2] that if we set cache mode
whose write semantic is not O_DIRECT (.i.e unsafe, writeback or writethrough),
there will be a problem with the volume drivers
(.i.e nova.virt.libvirt.volume.LibvirtISCSIVolumeDriver,
nova.virt.libvirt.volume.LibvirtNFSVolumeDriver and so on), which designate
native io explicitly.
That problem will generate a libvirt xml for the instance,
whose content contains
```
...
<disk ... >
<driver ... cache='unsafe/writeback/writethrough' io='native' />
</disk>
...
```
In turn, it will fail to start the instance or attach the disk.
> When qemu is configured with a block device that has aio=native set, but
> the cache mode doesn't use O_DIRECT (i.e. isn't cache=none/directsync or any
> unnamed mode with explicit cache.direct=on), then the raw-posix block driver
> for local files and block devices will silently fall back to aio=threads.
> The blockdev-add interface rejects such combinations, but qemu can't
> change the existing legacy interfaces that libvirt uses today.
Reviewed: https:/ /review. opendev. org/c/openstack /nova/+ /747612 /opendev. org/openstack/ nova/commit/ 6e6440fe97c0748 9ab6b70029a22fa 0b9b70bc02
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/rocky
commit 6e6440fe97c0748 9ab6b70029a22fa 0b9b70bc02
Author: Arthur Dayne <email address hidden>
Date: Tue Sep 17 19:08:59 2019 +0800
libvirt: driver: Disallow AIO=native when 'O_DIRECT' is not available
Because of the libvirt issue[1], there is a bug[2] that if we set cache mode libvirt. volume. LibvirtISCSIVol umeDriver, virt.libvirt. volume. LibvirtNFSVolum eDriver and so on), which designate
whose write semantic is not O_DIRECT (.i.e unsafe, writeback or writethrough),
there will be a problem with the volume drivers
(.i.e nova.virt.
nova.
native io explicitly.
That problem will generate a libvirt xml for the instance,
whose content contains
``` unsafe/ writeback/ writethrough' io='native' />
...
<disk ... >
<driver ... cache='
</disk>
...
```
In turn, it will fail to start the instance or attach the disk.
> When qemu is configured with a block device that has aio=native set, but directsync or any
> the cache mode doesn't use O_DIRECT (i.e. isn't cache=none/
> unnamed mode with explicit cache.direct=on), then the raw-posix block driver
> for local files and block devices will silently fall back to aio=threads.
> The blockdev-add interface rejects such combinations, but qemu can't
> change the existing legacy interfaces that libvirt uses today.
[1]: https:/ /github. com/libvirt/ libvirt/ commit/ 058384003db776c 580d0e5a3016a63 84e8eb7b92 /bugzilla. redhat. com/show_ bug.cgi? id=1086704
[2]: https:/
Closes-Bug: #1841363 33f3659a15dd9fc 2d462e84d64 df60bcd0e40b3e8 0f2db2e3a6) cc4fac25f63434c 9cab93b061) b7bbad52a1fe174 0e37bade9a) 757abbfaef4de3e 2c1fa4ead2)
Change-Id: If9acc054100a67
(cherry picked from commit af2405e1181d70c
(cherry picked from commit 0bd58921a1fcaff
(cherry picked from commit d92fe4f3e69db51
(cherry picked from commit cc2f45ebb03326c