From f55f69e12e4966c74580afb828b2e00e36978045 Mon Sep 17 00:00:00 2001 From: John Griffith <john.griffith@solidfire.com> Date: Thu, 19 Sep 2013 14:10:57 -0600 Subject: [PATCH] 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 --- tempest/services/volume/xml/volumes_client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py index 7915637131..b59ec039dc 100644 --- a/tempest/services/volume/xml/volumes_client.py +++ b/tempest/services/volume/xml/volumes_client.py @@ -65,9 +65,14 @@ class VolumesClientXML(RestClientXML): Check if the volume is bootable, also change the value 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 - elif volume['bootable'] == 'False': + elif volume['bootable'].lower() == 'false': volume['bootable'] = False else: raise ValueError(