diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample index 3f9e70eb4e..5b15c5ee34 100644 --- a/etc/tempest.conf.sample +++ b/etc/tempest.conf.sample @@ -1171,3 +1171,7 @@ # Is the v2 volume API enabled (boolean value) #api_v2 = true + +# Update bootable status of a volume Not implemented on icehouse +# (boolean value) +#bootable = false diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py index f571f2d160..375d34a37c 100644 --- a/tempest/api/volume/test_volumes_actions.py +++ b/tempest/api/volume/test_volumes_actions.py @@ -18,6 +18,7 @@ from tempest_lib.common.utils import data_utils from tempest.api.volume import base from tempest import config from tempest import test +import testtools CONF = config.CONF @@ -69,6 +70,18 @@ class VolumesV2ActionsTest(base.BaseVolumeTest): self.client.detach_volume(self.volume['id']) self.client.wait_for_volume_status(self.volume['id'], 'available') + @test.idempotent_id('63e21b4c-0a0c-41f6-bfc3-7c2816815599') + @testtools.skipUnless(CONF.volume_feature_enabled.bootable, + 'Update bootable status of a volume is not enabled.') + def test_volume_bootable(self): + # Verify that a volume bootable flag is retrieved + for bool_bootable in [True, False]: + self.client.set_bootable_volume(self.volume['id'], bool_bootable) + fetched_volume = self.client.show_volume(self.volume['id']) + # Get Volume information + bool_flag = self._is_true(fetched_volume['bootable']) + self.assertEqual(bool_bootable, bool_flag) + @test.idempotent_id('9516a2c8-9135-488c-8dd6-5677a7e5f371') @test.stresstest(class_setup_per='process') @test.services('compute') diff --git a/tempest/config.py b/tempest/config.py index 3f3e7e7448..bdbf9424f7 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -657,6 +657,10 @@ VolumeFeaturesGroup = [ cfg.BoolOpt('api_v2', default=True, help="Is the v2 volume API enabled"), + cfg.BoolOpt('bootable', + default=False, + help='Update bootable status of a volume ' + 'Not implemented on icehouse ') ] diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py index 9a08bbd8a6..65aa0f4469 100644 --- a/tempest/services/volume/json/volumes_client.py +++ b/tempest/services/volume/json/volumes_client.py @@ -123,6 +123,15 @@ class BaseVolumesClientJSON(service_client.ServiceClient): self.expected_success(202, resp.status) return service_client.ResponseBody(resp, body) + def set_bootable_volume(self, volume_id, bootable): + """set a bootable flag for a volume - true or false.""" + post_body = {"bootable": bootable} + post_body = json.dumps({'os-set_bootable': post_body}) + url = 'volumes/%s/action' % (volume_id) + resp, body = self.post(url, post_body) + self.expected_success(200, resp.status) + return service_client.ResponseBody(resp, body) + def detach_volume(self, volume_id): """Detaches a volume from an instance.""" post_body = {}