@@ -0,0 +1,1550 @@
+# Copyright 2016 NEC Corporation.  All rights reserved.%0A#%0A#    Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A#    not use this file except in compliance with the License. You may obtain%0A#    a copy of the License at%0A#%0A#         http://www.apache.org/licenses/LICENSE-2.0%0A#%0A#    Unless required by applicable law or agreed to in writing, software%0A#    distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A#    License for the specific language governing permissions and limitations%0A#    under the License.%0A%0Afrom tempest.api.compute import base%0Afrom tempest import config%0Afrom tempest.lib import exceptions as lib_exc%0Afrom tempest import test%0A%0ACONF = config.CONF%0A%0A%0Aclass AttachVolumeNegativeTest(base.BaseV2ComputeTest):%0A%0A    @classmethod%0A    def skip_checks(cls):%0A        super(AttachVolumeNegativeTest, cls).skip_checks()%0A        if not CONF.service_available.cinder:%0A            skip_msg = (%22%25s skipped as Cinder is not available%22 %25 cls.__name__)%0A            raise cls.skipException(skip_msg)%0A%0A    @test.idempotent_id('a313b5cd-fbd0-49cc-94de-870e99f763c7')%0A    def test_delete_attached_volume(self):%0A        server = self.create_test_server(wait_until='ACTIVE')%0A        volume = self.create_volume()%0A%0A        path = %22/dev/%25s%22 %25 CONF.compute.volume_device_name%0A        self.attach_volume(server, volume, device=path)%0A%0A        self.assertRaises(lib_exc.BadRequest,%0A                          self.delete_volume, volume%5B'id'%5D)%0A

Add negative tests for deleting attached volume