Consider lc string for bootable True/False

The xml.volumes_client check to translate the bootable
setting on a volume object only checks for Upper case strings
and bools.

It turns out that this test was introduced after a bug was introduced
to cinder.api which inadvertently changed the type used to set this
member field.  We now have a patch to fix this and put it back to "true/false"
(lc strings) but since the change there's a tempest test that verifies this.

This patch will check for string true/false either lc or uc, and will
keep the bool check in place as well (otherwise everything will fail).

This test did such a great job we should consider removing the other options
for true/false representations which would've caught the original error introduced
in Cinder (reference cinder lp# 1227837.

Fixes bug: 1227858

Change-Id: I8a4b1f4ce3a6a420e8152ea8c66a9b3fc127fe96
This commit is contained in:
John Griffith 2013-09-19 14:10:57 -06:00
parent ea8ce25d69
commit f55f69e12e

@ -65,9 +65,14 @@ class VolumesClientXML(RestClientXML):
Check if the volume is bootable, also change the value Check if the volume is bootable, also change the value
of 'bootable' from string to boolean. of 'bootable' from string to boolean.
""" """
if volume['bootable'] == 'True':
# NOTE(jdg): Version 1 of Cinder API uses lc strings
# We should consider being explicit in this check to
# avoid introducing bugs like: LP #1227837
if volume['bootable'].lower() == 'true':
volume['bootable'] = True volume['bootable'] = True
elif volume['bootable'] == 'False': elif volume['bootable'].lower() == 'false':
volume['bootable'] = False volume['bootable'] = False
else: else:
raise ValueError( raise ValueError(