Skip to content

Commit 7279d6f

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Rename CinderFixtureNewAttachFlow to CinderFixture"
2 parents d52c084 + 86b7873 commit 7279d6f

19 files changed

+48
-49
lines changed

nova/tests/fixtures.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,8 +1636,7 @@ def setUp(self):
16361636
lambda *args, **kwargs: mock.MagicMock()))
16371637

16381638

1639-
# TODO(mriedem): Just rename this to be CinderFixture.
1640-
class CinderFixtureNewAttachFlow(fixtures.Fixture):
1639+
class CinderFixture(fixtures.Fixture):
16411640
"""A fixture to volume operations with the new Cinder attach/detach API"""
16421641

16431642
# the default project_id in OSAPIFixtures
@@ -1658,7 +1657,7 @@ class CinderFixtureNewAttachFlow(fixtures.Fixture):
16581657
IMAGE_WITH_TRAITS_BACKED_VOL = '6194fc02-c60e-4a01-a8e5-600798208b5f'
16591658

16601659
def __init__(self, test):
1661-
super(CinderFixtureNewAttachFlow, self).__init__()
1660+
super(CinderFixture, self).__init__()
16621661
self.test = test
16631662
self.swap_volume_instance_uuid = None
16641663
self.swap_volume_instance_error_uuid = None
@@ -1684,7 +1683,7 @@ def volume_ids_for_instance(self, instance_uuid):
16841683
break
16851684

16861685
def setUp(self):
1687-
super(CinderFixtureNewAttachFlow, self).setUp()
1686+
super(CinderFixture, self).setUp()
16881687

16891688
def fake_get(self_api, context, volume_id, microversion=None):
16901689
# Check for the special swap volumes.

nova/tests/functional/api_sample_tests/test_servers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class ServersSampleJson267Test(ServersSampleBase):
369369

370370
def setUp(self):
371371
super(ServersSampleJson267Test, self).setUp()
372-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
372+
self.useFixture(nova_fixtures.CinderFixture(self))
373373

374374
def test_servers_post(self):
375375
return self._post_server(use_common_server_api_samples=False)

nova/tests/functional/api_sample_tests/test_volumes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ class VolumeAttachmentsSampleV249(VolumeAttachmentsSample):
350350

351351
def setUp(self):
352352
super(VolumeAttachmentsSampleV249, self).setUp()
353-
self.useFixture(fixtures.CinderFixtureNewAttachFlow(self))
353+
self.useFixture(fixtures.CinderFixture(self))
354354

355355
def _get_vol_attachment_subs(self, subs):
356356
return dict(subs, tag='foo')

nova/tests/functional/compute/test_live_migration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def setUp(self):
5454
self.compute2 = self.start_service('compute', host='host2')
5555

5656
def test_live_migrate_attachment_delete_fails(self):
57-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
57+
self.useFixture(nova_fixtures.CinderFixture(self))
5858
server = self.api.post_server({
5959
'server': {
6060
'flavorRef': 1,

nova/tests/functional/notification_sample_tests/test_instance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def setUp(self):
3333
super(TestInstanceNotificationSampleWithMultipleCompute, self).setUp()
3434
self.neutron = fixtures.NeutronFixture(self)
3535
self.useFixture(self.neutron)
36-
self.cinder = fixtures.CinderFixtureNewAttachFlow(self)
36+
self.cinder = fixtures.CinderFixture(self)
3737
self.useFixture(self.cinder)
3838
self.useFixture(fixtures.AllServicesCurrent())
3939

@@ -326,7 +326,7 @@ def setUp(self):
326326
super(TestInstanceNotificationSample, self).setUp()
327327
self.neutron = fixtures.NeutronFixture(self)
328328
self.useFixture(self.neutron)
329-
self.cinder = fixtures.CinderFixtureNewAttachFlow(self)
329+
self.cinder = fixtures.CinderFixture(self)
330330
self.useFixture(self.cinder)
331331

332332
def _wait_until_swap_volume(self, server, volume_id):

nova/tests/functional/notification_sample_tests/test_volume.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setUp(self):
2828
super(TestVolumeUsageNotificationSample, self).setUp()
2929
self.neutron = fixtures.NeutronFixture(self)
3030
self.useFixture(self.neutron)
31-
self.cinder = fixtures.CinderFixtureNewAttachFlow(self)
31+
self.cinder = fixtures.CinderFixture(self)
3232
self.useFixture(self.cinder)
3333

3434
def _setup_server_with_volume_attached(self):

nova/tests/functional/regressions/test_bug_1404867.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def _create_error_server(self, volume_id):
5959

6060
def test_delete_with_reserved_volumes_new(self):
6161
self.cinder = self.useFixture(
62-
nova_fixtures.CinderFixtureNewAttachFlow(self))
62+
nova_fixtures.CinderFixture(self))
6363

6464
# Create a server which should go to ERROR state because we don't
6565
# have any active computes.
66-
volume_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
66+
volume_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
6767
server = self._create_error_server(volume_id)
6868
server_id = server['id']
6969

nova/tests/functional/regressions/test_bug_1675570.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def setUp(self):
4646
self.useFixture(policy_fixture.RealPolicyFixture())
4747
# We need the CinderFixture to stub out the volume API.
4848
self.cinder = self.useFixture(
49-
nova_fixtures.CinderFixtureNewAttachFlow(self))
49+
nova_fixtures.CinderFixture(self))
5050
# The NeutronFixture is needed to stub out validate_networks in API.
5151
self.useFixture(nova_fixtures.NeutronFixture(self))
5252
# Use the PlacementFixture to avoid annoying warnings in the logs.

nova/tests/functional/regressions/test_bug_1732947.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class RebuildVolumeBackedSameImage(integrated_helpers._IntegratedTestBase,
3434
def setUp(self):
3535
super(RebuildVolumeBackedSameImage, self).setUp()
3636
# We are creating a volume-backed server so we need the CinderFixture.
37-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
37+
self.useFixture(nova_fixtures.CinderFixture(self))
3838

3939
def _setup_scheduler_service(self):
4040
# Add the IsolatedHostsFilter to the list of enabled filters since it
@@ -46,7 +46,7 @@ def _setup_scheduler_service(self):
4646

4747
def test_volume_backed_rebuild_same_image(self):
4848
# First create our server as normal.
49-
volume_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
49+
volume_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
5050
server_req_body = {
5151
# There is no imageRef because this is boot from volume.
5252
'server': {

nova/tests/functional/regressions/test_bug_1746483.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def setUp(self):
3939

4040
self.useFixture(policy_fixture.RealPolicyFixture())
4141
self.useFixture(nova_fixtures.NeutronFixture(self))
42-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
42+
self.useFixture(nova_fixtures.CinderFixture(self))
4343
self.useFixture(func_fixtures.PlacementFixture())
4444

4545
api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
@@ -71,7 +71,7 @@ def setUp(self):
7171

7272
def test_boot_from_volume_with_isolated_image(self):
7373
# Create our server without networking just to keep things simple.
74-
image_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
74+
image_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
7575
server_req_body = {
7676
# There is no imageRef because this is boot from volume.
7777
'server': {

nova/tests/functional/regressions/test_bug_1784353.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def setUp(self):
3232
super(TestRescheduleWithVolumesAttached, self).setUp()
3333

3434
# Use the new attach flow fixture for cinder
35-
cinder_fixture = nova_fixtures.CinderFixtureNewAttachFlow(self)
35+
cinder_fixture = nova_fixtures.CinderFixture(self)
3636
self.cinder = self.useFixture(cinder_fixture)
3737
self.useFixture(policy_fixture.RealPolicyFixture())
3838
self.useFixture(nova_fixtures.NeutronFixture(self))
@@ -63,7 +63,7 @@ def setUp(self):
6363

6464
def test_reschedule_with_volume_attached(self):
6565
# Boot a volume backed instance
66-
volume_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
66+
volume_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
6767
server_request = {
6868
'name': 'server',
6969
'flavorRef': self.flavor_id,

nova/tests/functional/regressions/test_bug_1806064.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def setUp(self):
4747
super(BootFromVolumeOverQuotaRaceDeleteTest, self).setUp()
4848
# We need the cinder fixture for boot from volume testing.
4949
self.cinder_fixture = self.useFixture(
50-
nova_fixtures.CinderFixtureNewAttachFlow(self))
50+
nova_fixtures.CinderFixture(self))
5151
# Use the standard fixtures.
5252
self.useFixture(policy_fixture.RealPolicyFixture())
5353
self.useFixture(nova_fixtures.NeutronFixture(self))
@@ -66,7 +66,7 @@ def test_bfv_quota_race_local_delete(self):
6666
# volume attachment record for the given pre-existing volume.
6767
# We also tag the server since tags, like BDMs, should be created in
6868
# the cell database along with the instance.
69-
volume_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
69+
volume_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
7070
server = {
7171
'server': {
7272
'name': 'test_bfv_quota_race_local_delete',

nova/tests/functional/regressions/test_bug_1825020.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def setUp(self):
3636
self.api = api_fixture.admin_api
3737

3838
self.useFixture(nova_fixtures.NeutronFixture(self))
39-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
39+
self.useFixture(nova_fixtures.CinderFixture(self))
4040
self.useFixture(func_fixtures.PlacementFixture())
4141
fake_image.stub_out_image_service(self)
4242
self.addCleanup(fake_image.FakeImageService_reset)
@@ -54,7 +54,7 @@ def test_volume_backed_resize_disk_down(self):
5454
flavor2 = flavors[1]
5555
self.assertGreater(flavor2['disk'], flavor1['disk'])
5656

57-
vol_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
57+
vol_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
5858
server = {
5959
'name': 'test_volume_backed_resize_disk_down',
6060
'imageRef': '',

nova/tests/functional/test_boot_from_volume.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def setUp(self):
4646
self.flags(allow_resize_to_same_host=True)
4747
super(BootFromVolumeTest, self).setUp()
4848
self.admin_api = self.api_fixture.admin_api
49-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
49+
self.useFixture(nova_fixtures.CinderFixture(self))
5050

5151
def test_boot_from_volume_larger_than_local_gb(self):
5252
# Verify no local disk is being used currently
@@ -62,7 +62,7 @@ def test_boot_from_volume_larger_than_local_gb(self):
6262
# disk. It should succeed for boot from volume.
6363
server = self._build_server(flavor_id)
6464
server['imageRef'] = ''
65-
volume_uuid = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
65+
volume_uuid = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
6666
bdm = {'boot_index': 0,
6767
'uuid': volume_uuid,
6868
'source_type': 'volume',
@@ -132,7 +132,7 @@ def test_boot_from_volume_larger_than_local_gb(self):
132132
self._verify_request_spec_flavor_not_zero(server_id)
133133

134134
# Rebuild
135-
# The image_uuid is from CinderFixtureNewAttachFlow for the
135+
# The image_uuid is from CinderFixture for the
136136
# volume representing IMAGE_BACKED_VOL.
137137
image_uuid = '155d900f-4e14-4e4c-a73d-069cbf4541e6'
138138
post_data = {'rebuild': {'imageRef': image_uuid}}

nova/tests/functional/test_conf_max_attach_disk_devices.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ConfigurableMaxDiskDevicesTest(integrated_helpers.InstanceHelperMixin,
2525
def setUp(self):
2626
super(ConfigurableMaxDiskDevicesTest, self).setUp()
2727
self.cinder = self.useFixture(
28-
nova_fixtures.CinderFixtureNewAttachFlow(self))
28+
nova_fixtures.CinderFixture(self))
2929

3030
def _wait_for_volume_attach(self, server_id, volume_id):
3131
for i in range(0, 100):
@@ -44,7 +44,7 @@ def test_boot_from_volume(self):
4444
self.flags(max_disk_devices_to_attach=1, group='compute')
4545
server = self._build_server(flavor_id='1')
4646
server['imageRef'] = ''
47-
volume_uuid = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
47+
volume_uuid = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
4848
bdm = {'boot_index': 0,
4949
'uuid': volume_uuid,
5050
'source_type': 'volume',
@@ -59,7 +59,7 @@ def test_boot_from_volume_plus_attach_max_exceeded(self):
5959
self.flags(max_disk_devices_to_attach=1, group='compute')
6060
server = self._build_server(flavor_id='1')
6161
server['imageRef'] = ''
62-
vol_img_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
62+
vol_img_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
6363
boot_vol = {'boot_index': 0,
6464
'uuid': vol_img_id,
6565
'source_type': 'volume',

nova/tests/functional/test_multiattach.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class TestMultiattachVolumes(integrated_helpers._IntegratedTestBase,
2020
"""Functional tests for creating a server from a multiattach volume
2121
and attaching a multiattach volume to a server.
2222
23-
Uses the CinderFixtureNewAttachFlow fixture with a specific volume ID
23+
Uses the CinderFixture fixture with a specific volume ID
2424
to represent a multiattach volume.
2525
"""
2626
# These are all used in _IntegratedTestBase.
@@ -35,13 +35,13 @@ def setUp(self):
3535
# multiattach.
3636
self.useFixture(nova_fixtures.AllServicesCurrent())
3737
super(TestMultiattachVolumes, self).setUp()
38-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
38+
self.useFixture(nova_fixtures.CinderFixture(self))
3939

4040
def test_boot_from_volume_and_attach_to_second_server(self):
4141
"""This scenario creates a server from the multiattach volume, waits
4242
for it to be ACTIVE, and then attaches the volume to another server.
4343
"""
44-
volume_id = nova_fixtures.CinderFixtureNewAttachFlow.MULTIATTACH_VOL
44+
volume_id = nova_fixtures.CinderFixture.MULTIATTACH_VOL
4545
create_req = self._build_server(flavor_id='1', image='')
4646
create_req['networks'] = 'none'
4747
create_req['block_device_mapping_v2'] = [{

nova/tests/functional/test_nova_manage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class TestNovaManagePlacementHealAllocations(
373373

374374
def setUp(self):
375375
super(TestNovaManagePlacementHealAllocations, self).setUp()
376-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
376+
self.useFixture(nova_fixtures.CinderFixture(self))
377377
self.cli = manage.PlacementCommands()
378378
# We need to start a compute in each non-cell0 cell.
379379
for cell_name, cell_mapping in self.cell_mappings.items():
@@ -410,7 +410,7 @@ def _boot_and_assert_no_allocations(self, flavor, hostname,
410410
networks='none')
411411
server_req['availability_zone'] = 'nova:%s' % hostname
412412
if volume_backed:
413-
vol_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
413+
vol_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
414414
server_req['block_device_mapping_v2'] = [{
415415
'source_type': 'volume',
416416
'destination_type': 'volume',

nova/tests/functional/test_servers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ def test_resize_server_overquota(self):
858858
self.assertEqual(403, ex.response.status_code)
859859

860860
def test_attach_vol_maximum_disk_devices_exceeded(self):
861-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
861+
self.useFixture(nova_fixtures.CinderFixture(self))
862862

863863
server = self._build_minimal_create_server_request()
864864
created_server = self.api.post_server({"server": server})
@@ -1583,7 +1583,7 @@ def test_volume_backed_rebuild_different_image(self):
15831583
different image than what is in the root disk of the root volume
15841584
will result in a 400 BadRequest error.
15851585
"""
1586-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
1586+
self.useFixture(nova_fixtures.CinderFixture(self))
15871587
# First create our server as normal.
15881588
server_req_body = {
15891589
# There is no imageRef because this is boot from volume.
@@ -1596,7 +1596,7 @@ def test_volume_backed_rebuild_different_image(self):
15961596
'block_device_mapping_v2': [{
15971597
'boot_index': 0,
15981598
'uuid':
1599-
nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL,
1599+
nova_fixtures.CinderFixture.IMAGE_BACKED_VOL,
16001600
'source_type': 'volume',
16011601
'destination_type': 'volume'
16021602
}]
@@ -3703,8 +3703,8 @@ def _create_server(self):
37033703
return server
37043704

37053705
def _create_volume_backed_server(self):
3706-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
3707-
volume_id = nova_fixtures.CinderFixtureNewAttachFlow.IMAGE_BACKED_VOL
3706+
self.useFixture(nova_fixtures.CinderFixture(self))
3707+
volume_id = nova_fixtures.CinderFixture.IMAGE_BACKED_VOL
37083708
server_req_body = {
37093709
# There is no imageRef because this is boot from volume.
37103710
'server': {
@@ -4013,12 +4013,12 @@ def test_image_trait_on_volume_backed_instance(self):
40134013
rp_uuid = self._get_provider_uuid_by_host(self.compute2.host)
40144014
self._set_provider_traits(rp_uuid, ['HW_CPU_X86_SGX'])
40154015

4016-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
4016+
self.useFixture(nova_fixtures.CinderFixture(self))
40174017
# Create our server with a volume containing the image meta data with a
40184018
# required trait
40194019
server = self._create_volume_backed_server_with_traits(
40204020
self.flavor_without_trait['id'],
4021-
nova_fixtures.CinderFixtureNewAttachFlow.
4021+
nova_fixtures.CinderFixture.
40224022
IMAGE_WITH_TRAITS_BACKED_VOL)
40234023

40244024
server = self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
@@ -4037,12 +4037,12 @@ def test_flavor_image_trait_on_volume_backed_instance(self):
40374037
self._set_provider_traits(rp_uuid, ['HW_CPU_X86_VMX',
40384038
'HW_CPU_X86_SGX'])
40394039

4040-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
4040+
self.useFixture(nova_fixtures.CinderFixture(self))
40414041
# Create our server with a flavor trait and a volume containing the
40424042
# image meta data with a required trait
40434043
server = self._create_volume_backed_server_with_traits(
40444044
self.flavor_with_trait['id'],
4045-
nova_fixtures.CinderFixtureNewAttachFlow.
4045+
nova_fixtures.CinderFixture.
40464046
IMAGE_WITH_TRAITS_BACKED_VOL)
40474047

40484048
server = self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
@@ -4109,11 +4109,11 @@ def test_image_trait_on_volume_backed_instance_no_valid_host(self):
41094109
fails to find a valid host since no compute node resource providers
41104110
have the trait.
41114111
"""
4112-
self.useFixture(nova_fixtures.CinderFixtureNewAttachFlow(self))
4112+
self.useFixture(nova_fixtures.CinderFixture(self))
41134113
# Create our server with a volume
41144114
server = self._create_volume_backed_server_with_traits(
41154115
self.flavor_without_trait['id'],
4116-
nova_fixtures.CinderFixtureNewAttachFlow.
4116+
nova_fixtures.CinderFixture.
41174117
IMAGE_WITH_TRAITS_BACKED_VOL)
41184118

41194119
# The server should go to ERROR state because there is no valid host.

0 commit comments

Comments
 (0)