A lot of tests fail due to Errno::ENOENT: No such file or directory @ rb_sysopen - /sys/block/<dev>/queue/discard_granularity when dev is a partition instead of a disk, so we should first find the disk of the partition and then read the discard_granularity file of the disk.
Example failure (DiscardQuickTests_discard_past_the_end_fails.log):
E, [2020-09-02T22:17:33.415373 #38027] ERROR -- : Error:
test_discard_past_the_end_fails(DiscardQuickTests):
Errno::ENOENT: No such file or directory @ rb_sysopen - /sys/block/sda1/queue/discard_granularity
/root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:17:in initialize' /root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:17:inopen'
/root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:17:in read_param' /root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:8:ininitialize'
/root/device-mapper-test-suite/lib/dmtest/thinp-mixin.rb:154:in new' /root/device-mapper-test-suite/lib/dmtest/thinp-mixin.rb:154:inwith_discardable_dev'
/root/device-mapper-test-suite/lib/dmtest/thinp-mixin.rb:167:in with_discardable_pool' /root/device-mapper-test-suite/lib/dmtest/tests/thin-provisioning/discard_tests.rb:558:inblock in '
I, [2020-09-02T22:17:33.415451 #38027] INFO -- : Peak bufio allocation was 0
A lot of tests fail due to
Errno::ENOENT: No such file or directory @ rb_sysopen - /sys/block/<dev>/queue/discard_granularity
when dev is a partition instead of a disk, so we should first find the disk of the partition and then read the discard_granularity file of the disk.Example failure (DiscardQuickTests_discard_past_the_end_fails.log):
E, [2020-09-02T22:17:33.415373 #38027] ERROR -- : Error: test_discard_past_the_end_fails(DiscardQuickTests): Errno::ENOENT: No such file or directory @ rb_sysopen - /sys/block/sda1/queue/discard_granularity /root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:17:in'
I, [2020-09-02T22:17:33.415451 #38027] INFO -- : Peak bufio allocation was 0
initialize' /root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:17:in
open' /root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:17:inread_param' /root/device-mapper-test-suite/lib/dmtest/discard_limits.rb:8:in
initialize' /root/device-mapper-test-suite/lib/dmtest/thinp-mixin.rb:154:innew' /root/device-mapper-test-suite/lib/dmtest/thinp-mixin.rb:154:in
with_discardable_dev' /root/device-mapper-test-suite/lib/dmtest/thinp-mixin.rb:167:inwith_discardable_pool' /root/device-mapper-test-suite/lib/dmtest/tests/thin-provisioning/discard_tests.rb:558:in
block in