fix blockdev.tune issue, where blockdev.tune doesn't report changes for read-write option and where it didn't translate boolean options properly, causing the underlying blockdev call to fail

This commit is contained in:
Robert Fach 2015-03-11 16:22:18 +00:00
parent 3012e98577
commit d29bb2f24a

View File

@ -52,7 +52,9 @@ def tune(device, **kwargs):
switch = kwarg_map[key]
if key != 'read-write':
args.append(switch.replace('set', 'get'))
if kwargs[key] == 'True':
else:
args.append('getro')
if kwargs[key] == 'True' or kwargs[key] == True:
opts += '--{0} '.format(key)
else:
opts += '--{0} {1} '.format(switch, kwargs[key])