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.
Change-Id: I5151ae01e90506747860d9780547b0d4ce91d8bc
Closes-Bug: 1801702
Co-Authored-By: Alexandre Arents <alexandre.arents@corp.ovh.com>
(cherry picked from commit 14d98ef1b4
)
This commit is contained in:
parent
7520d159b5
commit
386e574f4a
@ -43,8 +43,8 @@ def supports_direct_io(dirpath):
|
||||
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)
|
||||
|
8
releasenotes/notes/bug-1801702-c8203d3d55007deb.yaml
Normal file
8
releasenotes/notes/bug-1801702-c8203d3d55007deb.yaml
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user