diff --git a/nova/tests/fixtures.py b/nova/tests/fixtures.py index df270a1d7452..e32d6cdfef55 100644 --- a/nova/tests/fixtures.py +++ b/nova/tests/fixtures.py @@ -1479,7 +1479,6 @@ class CinderFixture(fixtures.Fixture): def __init__(self, test): super(CinderFixture, self).__init__() self.test = test - self.swap_error = False self.swap_volume_instance_uuid = None self.swap_volume_instance_error_uuid = None self.reserved_volumes = list() @@ -1588,11 +1587,6 @@ class CinderFixture(fixtures.Fixture): if volume_id in self.reserved_volumes: self.reserved_volumes.remove(volume_id) - # Signaling that swap_volume has encountered the error - # from initialize_connection and is working on rolling back - # the reservation on SWAP_ERR_NEW_VOL. - self.swap_error = True - def fake_attach(_self, context, volume_id, instance_uuid, mountpoint, mode='rw'): # Check to see if the volume is already attached to any server. @@ -1675,7 +1669,6 @@ class CinderFixtureNewAttachFlow(fixtures.Fixture): def __init__(self, test): super(CinderFixtureNewAttachFlow, self).__init__() self.test = test - self.swap_error = False self.swap_volume_instance_uuid = None self.swap_volume_instance_error_uuid = None self.attachment_error_id = None @@ -1819,9 +1812,6 @@ class CinderFixtureNewAttachFlow(fixtures.Fixture): _, attachment, attachments = _find_attachment(attachment_id) attachments.remove(attachment) - if attachment_id == CinderFixtureNewAttachFlow.SWAP_ERR_ATTACH_ID: - self.swap_error = True - def fake_attachment_update(_self, context, attachment_id, connector, mountpoint=None): # Ensure the attachment exists @@ -1832,6 +1822,8 @@ class CinderFixtureNewAttachFlow(fixtures.Fixture): {'foo': 'bar', 'target_lun': '1'}}} if attachment_id == CinderFixtureNewAttachFlow.SWAP_ERR_ATTACH_ID: + # This intentionally triggers a TypeError for the + # instance.volume_swap.error versioned notification tests. attachment_ref = {'connection_info': ()} return attachment_ref diff --git a/nova/tests/functional/notification_sample_tests/test_instance.py b/nova/tests/functional/notification_sample_tests/test_instance.py index de2d8c98eaff..f4432d97a782 100644 --- a/nova/tests/functional/notification_sample_tests/test_instance.py +++ b/nova/tests/functional/notification_sample_tests/test_instance.py @@ -336,13 +336,6 @@ class TestInstanceNotificationSample( time.sleep(0.5) self.fail('Volume swap operation failed.') - def _wait_until_swap_volume_error(self): - for i in range(50): - if self.cinder.swap_error: - return - time.sleep(0.5) - self.fail("Timed out waiting for volume swap error to occur.") - def test_instance_action(self): # A single test case is used to test most of the instance action # notifications to avoid booting up an instance for every action @@ -1534,13 +1527,9 @@ class TestInstanceNotificationSample( self._volume_swap_server(server, self.cinder.SWAP_ERR_OLD_VOL, self.cinder.SWAP_ERR_NEW_VOL) - self._wait_until_swap_volume_error() + self._wait_for_notification('compute.exception') - # Seven versioned notifications are generated. We only rely on the - # first six because _wait_until_swap_volume_error will return True - # after volume_api.unreserve is called on the cinder fixture, and that - # happens before the instance fault is handled in the compute manager - # which generates the last notification (compute.exception). + # Eight versioned notifications are generated. # 0. instance-create-start # 1. instance-create-end # 2. instance-update