From bcc7ee871a4eb65ca220577b3244b247fa567422 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 26 Oct 2017 10:25:13 -0400 Subject: [PATCH] Add negative test for attaching an attached volume to the same instance This scenario came up during the volume multi-attach spec review in Nova and is something we should be sure is not allowed with a volume that is already attached since Nova does not yet support volume multi-attach. Change-Id: I98e25554d39449178df696a0d90cc62b662eda24 Depends-On: Ifc01dbf98545104c998ab96f65ff8623a6db0f28 --- .../volumes/test_attach_volume_negative.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tempest/api/compute/volumes/test_attach_volume_negative.py b/tempest/api/compute/volumes/test_attach_volume_negative.py index eabb907eed..7a748694c7 100644 --- a/tempest/api/compute/volumes/test_attach_volume_negative.py +++ b/tempest/api/compute/volumes/test_attach_volume_negative.py @@ -41,3 +41,18 @@ class AttachVolumeNegativeTest(base.BaseV2ComputeTest): self.assertRaises(lib_exc.BadRequest, self.delete_volume, volume['id']) + + @decorators.attr(type=['negative']) + @decorators.idempotent_id('aab919e2-d992-4cbb-a4ed-745c2475398c') + def test_attach_attached_volume_to_same_server(self): + # Test attaching the same volume to the same instance once + # it's already attached. The nova/cinder validation for this differs + # depending on whether or not cinder v3.27 is being used to attach + # the volume to the instance. + server = self.create_test_server(wait_until='ACTIVE') + volume = self.create_volume() + + self.attach_volume(server, volume) + + self.assertRaises(lib_exc.BadRequest, + self.attach_volume, server, volume)