ext/block: accept any boolean value for 'read-only' option

Be consistent with other parts of the Admin API. Especially ...Attach
accept "standard" boolean values for persistent= option.
This commit is contained in:
Marek Marczykowski-Górecki 2017-10-04 15:19:51 +02:00
parent af60fbb25d
commit 451cc339c7
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -243,10 +243,8 @@ class BlockDeviceExtension(qubes.ext.Extension):
raise qubes.exc.QubesValueError( raise qubes.exc.QubesValueError(
'Invalid frontend-dev option value: ' + value) 'Invalid frontend-dev option value: ' + value)
elif option == 'read-only': elif option == 'read-only':
if value not in ('yes', 'no'): options[option] = (
raise qubes.exc.QubesValueError( 'yes' if qubes.property.bool(None, None, value) else 'no')
'read-only option can only have '
'\'yes\' or \'no\' value')
elif option == 'devtype': elif option == 'devtype':
if value not in ('disk', 'cdrom'): if value not in ('disk', 'cdrom'):
raise qubes.exc.QubesValueError( raise qubes.exc.QubesValueError(