mirror of https://github.com/ansible/ansible.git
facts/hardware: Fix support_discard block device fact (#83480)
Previously, `support_discard` simply returned the value of `/sys/block/{device}/queue/discard_granularity`. When its value is `0`, then the block device doesn't support discards; _however_, it being greater than zero doesn't necessarily mean that the block device _does_ support discards. But another indication that a block device doesn't support discards is `/sys/block/{device}/queue/discard_max_hw_bytes` being equal to `0` (with the same caveat as above). So if either of those are `0`, set `support_discard` to zero, otherwise set it to the value of `discard_granularity` for backwards compatibility. Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>pull/83511/head
parent
2930a4664c
commit
41ba6536cf
@ -0,0 +1,6 @@
|
||||
---
|
||||
bugfixes:
|
||||
- facts - `support_discard` now returns `0` if either `discard_granularity`
|
||||
or `discard_max_hw_bytes` is zero; otherwise it returns the value of
|
||||
`discard_granularity`, as before
|
||||
(https://github.com/ansible/ansible/pull/83480).
|
Loading…
Reference in New Issue