BmapCopy: fix writitng to a dm-zero device
Dm-zero devices expose "none" in their '/sys/block/<disk>/queue/scheduler' file
and there is no current scheduler. Our code was assuming there is always the
current scheduler in brackets (e.g., "noop deadline [cfq]"), which lead to a
crash when writing to a dm-zero device:
Traceback (most recent call last):
File "./bmaptool", line 389, in <module>
sys.exit(main())
File "./bmaptool", line 373, in main
args.func(args, log)
File "./bmaptool", line 192, in copy_command
writer.copy(False, not args.no_verify)
File "/mnt/bigssd/dedekind/work/tizen/tools/git/bmap-tools/bmaptools/BmapCopy.py", line 578, in copy
self._tune_block_device()
File "/mnt/bigssd/dedekind/work/tizen/tools/git/bmap-tools/bmaptools/BmapCopy.py", line 535, in _tune_block_device
self._old_scheduler_value = match.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
This patch fixes the crash.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Change-Id: Ic13f4f69ee859244e5413d4b0b890d6c599becae