Encryption Test Scenario for clone volume
Depends-on: https://review.opendev.org/#/c/762884/ Related-Bug: #1904440 Change-Id: I846b96ef925c34162cf462da91d854ceacabe022
This commit is contained in:
parent
5d32357080
commit
ef3f5a28c0
76
cinder_tempest_plugin/scenario/test_volume_encrypted.py
Normal file
76
cinder_tempest_plugin/scenario/test_volume_encrypted.py
Normal file
@ -0,0 +1,76 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest.common import utils
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.scenario import manager
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class TestEncryptedCinderVolumes(manager.EncryptionScenarioTest,
|
||||
manager.ScenarioTest):
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(TestEncryptedCinderVolumes, cls).skip_checks()
|
||||
if not CONF.compute_feature_enabled.attach_encrypted_volume:
|
||||
raise cls.skipException('Encrypted volume attach is not supported')
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(TestEncryptedCinderVolumes, cls).resource_setup()
|
||||
|
||||
@classmethod
|
||||
def resource_cleanup(cls):
|
||||
super(TestEncryptedCinderVolumes, cls).resource_cleanup()
|
||||
|
||||
def launch_instance(self):
|
||||
image = self.image_create()
|
||||
keypair = self.create_keypair()
|
||||
|
||||
return self.create_server(image_id=image, key_name=keypair['name'])
|
||||
|
||||
def attach_detach_volume(self, server, volume):
|
||||
attached_volume = self.nova_volume_attach(server, volume)
|
||||
self.nova_volume_detach(server, attached_volume)
|
||||
|
||||
@decorators.idempotent_id('5bb622ab-5060-48a8-8840-d589a548b7e4')
|
||||
@utils.services('volume')
|
||||
def test_attach_cloned_encrypted_volume(self):
|
||||
"""Create clone from volume
|
||||
|
||||
Create another encrypted volume from source_volumeid
|
||||
Boot an instance from volume and verify its up.
|
||||
"""
|
||||
|
||||
volume = self.create_encrypted_volume('luks', volume_type='luks')
|
||||
kwargs = {
|
||||
'display_name': data_utils.rand_name(self.__class__.__name__),
|
||||
'source_volid': volume['id'],
|
||||
'volume_type': volume['volume_type'],
|
||||
'size': volume['size']
|
||||
}
|
||||
volume_s = self.volumes_client.create_volume(**kwargs)['volume']
|
||||
self.addCleanup(self.volumes_client.wait_for_resource_deletion,
|
||||
volume_s['id'])
|
||||
self.addCleanup(self.volumes_client.delete_volume, volume_s['id'])
|
||||
waiters.wait_for_volume_resource_status(
|
||||
self.volumes_client, volume_s['id'], 'available')
|
||||
volume_source = self.volumes_client.show_volume(
|
||||
volume_s['id'])['volume']
|
||||
|
||||
server = self.launch_instance()
|
||||
self.attach_detach_volume(server, volume_source)
|
Loading…
Reference in New Issue
Block a user