Merge "To test bootable flag in a cinder volume"
This commit is contained in:
commit
278f8744ab
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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 ')
|
||||
]
|
||||
|
||||
|
||||
|
@ -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 = {}
|
||||
|
Loading…
Reference in New Issue
Block a user