summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Harbott <j.harbott@x-ion.de>2018-11-08 15:06:26 +0000
committerElod Illes <elod.illes@ericsson.com>2019-01-18 18:17:50 +0100
commitc77c3eb61ca7a0da64eed62dea084ee3df1d0722 (patch)
tree3dfa5bb87cffe6d5a4b762031e6e8d2abb1bfb7d
parent8c663dbd25a0dab1c2d903efc7cf7fc3d9d07b00 (diff)
downloadnova-c77c3eb61ca7a0da64eed62dea084ee3df1d0722.tar.gz
Make supports_direct_io work on 4096b sector size
The current check uses an alignment of 512 bytes and will fail when the underlying device has sectors of size 4096 bytes, as is common e.g. for NVMe disks. So use an alignment of 4096 bytes, which is a multiple of 512 bytes and thus will cover both cases. Conflicts: nova/privsep/utils.py - supports_direct_io() is still in nova/virt/libvirt/driver.py for this branch Change-Id: I5151ae01e90506747860d9780547b0d4ce91d8bc Closes-Bug: 1801702 Co-Authored-By: Alexandre Arents <alexandre.arents@corp.ovh.com> (cherry picked from commit 14d98ef1b48ca7b2ea468a8f1ec967b954955a63) (cherry picked from commit ba844f2a7c1d4602017bb0fc600a30b150c28dbc)
-rw-r--r--nova/virt/libvirt/driver.py4
-rw-r--r--releasenotes/notes/bug-1801702-c8203d3d55007deb.yaml8
2 files changed, 10 insertions, 2 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index b0e4395b2d..69eaebc185 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -2972,8 +2972,8 @@ class LibvirtDriver(driver.ComputeDriver):
fd = None
try:
fd = os.open(testfile, os.O_CREAT | os.O_WRONLY | os.O_DIRECT)
- # Check is the write allowed with 512 byte alignment
- align_size = 512
+ # Check is the write allowed with 4096 byte alignment
+ align_size = 4096
m = mmap.mmap(-1, align_size)
m.write(b"x" * align_size)
os.write(fd, m)
diff --git a/releasenotes/notes/bug-1801702-c8203d3d55007deb.yaml b/releasenotes/notes/bug-1801702-c8203d3d55007deb.yaml
new file mode 100644
index 0000000000..67fa573c49
--- /dev/null
+++ b/releasenotes/notes/bug-1801702-c8203d3d55007deb.yaml
@@ -0,0 +1,8 @@
+---
+fixes:
+ - |
+ When testing whether direct IO is possible on the backing storage
+ for an instance, Nova now uses a block size of 4096 bytes instead
+ of 512 bytes, avoiding issues when the underlying block device has
+ sectors larger than 512 bytes. See bug
+ https://launchpad.net/bugs/1801702 for details.