Merge "Wait for guest to boot before attach a volume"
This commit is contained in:
commit
bb4daf11d5
|
@ -25,6 +25,11 @@ CONF = config.CONF
|
|||
class TestVolumeSwapBase(base.BaseV2ComputeAdminTest):
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
def setup_credentials(cls):
|
||||
cls.prepare_instance_network()
|
||||
super(TestVolumeSwapBase, cls).setup_credentials()
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(TestVolumeSwapBase, cls).skip_checks()
|
||||
|
@ -100,7 +105,16 @@ class TestVolumeSwap(TestVolumeSwapBase):
|
|||
volume1 = self.create_volume()
|
||||
volume2 = self.create_volume()
|
||||
# Boot server
|
||||
server = self.create_test_server(wait_until='ACTIVE')
|
||||
validation_resources = self.get_class_validation_resources(
|
||||
self.os_primary)
|
||||
# NOTE(gibi): We need to wait for the guest to fully boot as the test
|
||||
# will attach a volume to the server and therefore cleanup will try to
|
||||
# detach it. See bug 1960346 for details.
|
||||
server = self.create_test_server(
|
||||
validatable=True,
|
||||
validation_resources=validation_resources,
|
||||
wait_until='SSHABLE'
|
||||
)
|
||||
# Attach "volume1" to server
|
||||
self.attach_volume(server, volume1)
|
||||
# Swap volume from "volume1" to "volume2"
|
||||
|
@ -200,9 +214,18 @@ class TestMultiAttachVolumeSwap(TestVolumeSwapBase):
|
|||
volume2 = self.create_volume(multiattach=True)
|
||||
|
||||
# Create two servers and wait for them to be ACTIVE.
|
||||
validation_resources = self.get_class_validation_resources(
|
||||
self.os_primary)
|
||||
# NOTE(gibi): We need to wait for the guests to fully boot as the test
|
||||
# will attach volumes to the servers and therefore cleanup will try to
|
||||
# detach them. See bug 1960346 for details.
|
||||
reservation_id = self.create_test_server(
|
||||
wait_until='ACTIVE', min_count=2,
|
||||
return_reservation_id=True)['reservation_id']
|
||||
validatable=True,
|
||||
validation_resources=validation_resources,
|
||||
wait_until='SSHABLE',
|
||||
min_count=2,
|
||||
return_reservation_id=True,
|
||||
)['reservation_id']
|
||||
# Get the servers using the reservation_id.
|
||||
servers = self.servers_client.list_servers(
|
||||
reservation_id=reservation_id)['servers']
|
||||
|
|
|
@ -27,6 +27,11 @@ class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
|
|||
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
def setup_credentials(cls):
|
||||
cls.prepare_instance_network()
|
||||
super(VolumesAdminNegativeTest, cls).setup_credentials()
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(VolumesAdminNegativeTest, cls).skip_checks()
|
||||
|
@ -34,15 +39,11 @@ class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
|
|||
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
|
||||
raise cls.skipException(skip_msg)
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(VolumesAdminNegativeTest, cls).resource_setup()
|
||||
cls.server = cls.create_test_server(wait_until='ACTIVE')
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('309b5ecd-0585-4a7e-a36f-d2b2bf55259d')
|
||||
def test_update_attached_volume_with_nonexistent_volume_in_uri(self):
|
||||
"""Test swapping non existent volume should fail"""
|
||||
self.server = self.create_test_server(wait_until="ACTIVE")
|
||||
volume = self.create_volume()
|
||||
nonexistent_volume = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
|
@ -55,6 +56,17 @@ class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
|
|||
@decorators.idempotent_id('7dcac15a-b107-46d3-a5f6-cb863f4e454a')
|
||||
def test_update_attached_volume_with_nonexistent_volume_in_body(self):
|
||||
"""Test swapping volume to a non existence volume should fail"""
|
||||
validation_resources = self.get_class_validation_resources(
|
||||
self.os_primary)
|
||||
# NOTE(gibi): We need to wait for the guest to fully boot as
|
||||
# test_update_attached_volume_with_nonexistent_volume_in_body case
|
||||
# will attach a volume to it and therefore cleanup will try to detach
|
||||
# it. See bug 1960346 for details.
|
||||
self.server = self.create_test_server(
|
||||
validatable=True,
|
||||
validation_resources=validation_resources,
|
||||
wait_until="SSHABLE")
|
||||
|
||||
volume = self.create_volume()
|
||||
self.attach_volume(self.server, volume)
|
||||
|
||||
|
@ -76,6 +88,13 @@ class UpdateMultiattachVolumeNegativeTest(base.BaseV2ComputeAdminTest):
|
|||
min_microversion = '2.60'
|
||||
volume_min_microversion = '3.27'
|
||||
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
def setup_credentials(cls):
|
||||
cls.prepare_instance_network()
|
||||
super(UpdateMultiattachVolumeNegativeTest, cls).setup_credentials()
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(UpdateMultiattachVolumeNegativeTest, cls).skip_checks()
|
||||
|
@ -101,8 +120,21 @@ class UpdateMultiattachVolumeNegativeTest(base.BaseV2ComputeAdminTest):
|
|||
vol2 = self.create_volume(multiattach=True)
|
||||
|
||||
# Create two instances.
|
||||
server1 = self.create_test_server(wait_until='ACTIVE')
|
||||
server2 = self.create_test_server(wait_until='ACTIVE')
|
||||
validation_resources = self.get_class_validation_resources(
|
||||
self.os_primary)
|
||||
# NOTE(gibi): We need to wait for the guests to fully boot as the test
|
||||
# will attach volumes to the servers and therefore cleanup will try to
|
||||
# detach them. See bug 1960346 for details.
|
||||
server1 = self.create_test_server(
|
||||
validatable=True,
|
||||
validation_resources=validation_resources,
|
||||
wait_until='SSHABLE'
|
||||
)
|
||||
server2 = self.create_test_server(
|
||||
validatable=True,
|
||||
validation_resources=validation_resources,
|
||||
wait_until='SSHABLE'
|
||||
)
|
||||
|
||||
# Attach vol1 to both of these instances.
|
||||
vol1_attachment1 = self.attach_volume(server1, vol1)
|
||||
|
|
Loading…
Reference in New Issue