From: Jenkins Date: Sun, 1 Sep 2013 14:06:39 +0000 (+0000) Subject: Merge "Fixes bug to allow for encrypted volume deletion" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=3a30b8ae6c48f11550b5fd9ecf8315840e7a5ac2;p=openstack-build%2Fcinder-build.git Merge "Fixes bug to allow for encrypted volume deletion" --- 3a30b8ae6c48f11550b5fd9ecf8315840e7a5ac2 diff --cc cinder/tests/test_volume.py index 1673f9a1e,9aa77de47..9c2a0f230 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@@ -312,9 -322,49 +312,49 @@@ class VolumeTestCase(BaseVolumeTestCase self.assertEquals(volume['volume_type_id'], db_vol_type.get('id')) self.assertIsNotNone(volume['encryption_key_id']) + def test_create_delete_volume_with_encrypted_volume_type(self): + self.stubs.Set(keymgr, "API", fake_keymgr.fake_api) + + ctxt = context.get_admin_context() + + db.volume_type_create(ctxt, + {'id': '61298380-0c12-11e3-bfd6-4b48424183be', + 'name': 'LUKS'}) + db.volume_type_encryption_update_or_create( + ctxt, + '61298380-0c12-11e3-bfd6-4b48424183be', + {'control_location': 'front-end', 'provider': ENCRYPTION_PROVIDER}) + + volume_api = cinder.volume.api.API() + + db_vol_type = db.volume_type_get_by_name(ctxt, 'LUKS') + + volume = volume_api.create(self.context, + 1, + 'name', + 'description', + volume_type=db_vol_type) + + self.assertIsNotNone(volume.get('encryption_key_id', None)) + self.assertEquals(volume['volume_type_id'], db_vol_type.get('id')) + self.assertIsNotNone(volume['encryption_key_id']) + + volume['host'] = 'fake_host' + volume['status'] = 'available' + volume_api.delete(self.context, volume) + + volume = db.volume_get(self.context, volume['id']) + self.assertEquals('deleting', volume['status']) + + db.volume_destroy(self.context, volume['id']) + self.assertRaises(exception.NotFound, + db.volume_get, + self.context, + volume['id']) + def test_delete_busy_volume(self): """Test volume survives deletion if driver reports it as busy.""" - volume = self._create_volume() + volume = tests_utils.create_volume(self.context, **self.volume_params) volume_id = volume['id'] self.volume.create_volume(self.context, volume_id)