blob: eed3d0b773c42351fc9ebd8d3c91934b00513591 [file] [log] [blame]
Kaitlin Farr366a51f2014-04-21 12:43:54 -04001# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.scenario import manager
17from tempest import test
18
19
20class TestEncryptedCinderVolumes(manager.EncryptionScenarioTest):
21
22 """
23 This test is for verifying the functionality of encrypted cinder volumes.
24
25 For both LUKS and cryptsetup encryption types, this test performs
26 the following:
27 * Creates an image in Glance
28 * Boots an instance from the image
29 * Creates an encryption type (as admin)
30 * Creates a volume of that encryption type (as a regular user)
31 * Attaches and detaches the encrypted volume to the instance
Kaitlin Farr366a51f2014-04-21 12:43:54 -040032 """
33
34 def launch_instance(self):
35 self.glance_image_create()
36 self.nova_boot()
37
38 def create_encrypted_volume(self, encryption_provider):
39 volume_type = self.create_volume_type(name='luks')
Masayuki Igawa1f0ad632014-08-05 13:36:56 +090040 self.create_encryption_type(type_id=volume_type['id'],
Kaitlin Farr366a51f2014-04-21 12:43:54 -040041 provider=encryption_provider,
42 key_size=512,
43 cipher='aes-xts-plain64',
44 control_location='front-end')
Masayuki Igawa1f0ad632014-08-05 13:36:56 +090045 self.volume = self.create_volume(volume_type=volume_type['name'])
Kaitlin Farr366a51f2014-04-21 12:43:54 -040046
47 def attach_detach_volume(self):
48 self.nova_volume_attach()
49 self.nova_volume_detach()
50
Chris Hoge7579c1a2015-02-26 14:12:15 -080051 @test.idempotent_id('79165fb4-5534-4b9d-8429-97ccffb8f86e')
Kaitlin Farr366a51f2014-04-21 12:43:54 -040052 @test.services('compute', 'volume', 'image')
53 def test_encrypted_cinder_volumes_luks(self):
54 self.launch_instance()
55 self.create_encrypted_volume('nova.volume.encryptors.'
56 'luks.LuksEncryptor')
57 self.attach_detach_volume()
Kaitlin Farr366a51f2014-04-21 12:43:54 -040058
Chris Hoge7579c1a2015-02-26 14:12:15 -080059 @test.idempotent_id('cbc752ed-b716-4717-910f-956cce965722')
Kaitlin Farr366a51f2014-04-21 12:43:54 -040060 @test.services('compute', 'volume', 'image')
61 def test_encrypted_cinder_volumes_cryptsetup(self):
62 self.launch_instance()
63 self.create_encrypted_volume('nova.volume.encryptors.'
64 'cryptsetup.CryptsetupEncryptor')
Joe Gordon28788b42015-02-25 12:42:37 -080065 self.attach_detach_volume()