Skip to content

Commit 95dc5d0

Browse files
committed
Stop handling 'InstanceUnknownCell' exception
This was only raised by cells v1 code and therefore no longer needs to be handled. A future change will remove the exception itself. Part of blueprint remove-cells-v1 Change-Id: I1dd6abcc2be17ff76f108e7ff3771314f33259c6 Signed-off-by: Stephen Finucane <[email protected]>
1 parent d4f58f5 commit 95dc5d0

17 files changed

+8
-92
lines changed

nova/api/openstack/compute/admin_actions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ def _reset_network(self, req, id, body):
4444
instance = common.get_instance(self.compute_api, context, id)
4545
try:
4646
self.compute_api.reset_network(context, instance)
47-
except exception.InstanceUnknownCell as e:
48-
raise exc.HTTPNotFound(explanation=e.format_message())
4947
except exception.InstanceIsLocked as e:
5048
raise exc.HTTPConflict(explanation=e.format_message())
5149

@@ -59,8 +57,6 @@ def _inject_network_info(self, req, id, body):
5957
instance = common.get_instance(self.compute_api, context, id)
6058
try:
6159
self.compute_api.inject_network_info(context, instance)
62-
except exception.InstanceUnknownCell as e:
63-
raise exc.HTTPNotFound(explanation=e.format_message())
6460
except exception.InstanceIsLocked as e:
6561
raise exc.HTTPConflict(explanation=e.format_message())
6662

nova/api/openstack/compute/admin_password.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def change_password(self, req, id, body):
4747
password = body['changePassword']['adminPass']
4848
try:
4949
self.compute_api.set_admin_password(context, instance, password)
50-
except exception.InstanceUnknownCell as e:
51-
raise exc.HTTPNotFound(explanation=e.format_message())
5250
except (exception.InstancePasswordSetFailed,
5351
exception.SetAdminPasswdNotSupported,
5452
exception.InstanceAgentNotEnabled) as e:

nova/api/openstack/compute/create_backup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ def _create_backup(self, req, id, body):
6868
try:
6969
image = self.compute_api.backup(context, instance, image_name,
7070
backup_type, rotation, extra_properties=props)
71-
except exception.InstanceUnknownCell as e:
72-
raise webob.exc.HTTPNotFound(explanation=e.format_message())
7371
except exception.InstanceInvalidState as state_error:
7472
common.raise_http_conflict_for_instance_invalid_state(state_error,
7573
'createBackup', id)

nova/api/openstack/compute/deferred_delete.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ def _restore(self, req, id, body):
3939
instance = common.get_instance(self.compute_api, context, id)
4040
try:
4141
self.compute_api.restore(context, instance)
42-
except exception.InstanceUnknownCell as error:
43-
raise webob.exc.HTTPNotFound(explanation=error.format_message())
4442
except exception.QuotaError as error:
4543
raise webob.exc.HTTPForbidden(explanation=error.format_message())
4644
except exception.InstanceInvalidState as state_error:
@@ -59,8 +57,7 @@ def _force_delete(self, req, id, body):
5957
'project_id': instance.project_id})
6058
try:
6159
self.compute_api.force_delete(context, instance)
62-
except (exception.InstanceNotFound,
63-
exception.InstanceUnknownCell) as e:
60+
except exception.InstanceNotFound as e:
6461
raise webob.exc.HTTPNotFound(explanation=e.format_message())
6562
except exception.InstanceIsLocked as e:
6663
raise webob.exc.HTTPConflict(explanation=e.format_message())

nova/api/openstack/compute/evacuate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ def _evacuate(self, req, id, body):
132132
try:
133133
self.compute_api.evacuate(context, instance, host,
134134
on_shared_storage, password, force)
135-
except exception.InstanceUnknownCell as e:
136-
raise exc.HTTPNotFound(explanation=e.format_message())
137135
except exception.InstanceInvalidState as state_error:
138136
common.raise_http_conflict_for_instance_invalid_state(state_error,
139137
'evacuate', id)

nova/api/openstack/compute/floating_ips.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,6 @@ def _add_floating_ip(self, req, id, body):
272272
except exception.NoFloatingIpInterface:
273273
msg = _('l3driver call to add floating IP failed')
274274
raise webob.exc.HTTPBadRequest(explanation=msg)
275-
except exception.InstanceUnknownCell as e:
276-
raise webob.exc.HTTPNotFound(explanation=e.format_message())
277275
except exception.FloatingIpNotFoundForAddress:
278276
msg = _('floating IP not found')
279277
raise webob.exc.HTTPNotFound(explanation=msg)

nova/api/openstack/compute/migrate_server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ def _migrate_live(self, req, id, body):
139139
self.compute_api.live_migrate(context, instance, block_migration,
140140
disk_over_commit, host, force,
141141
async_)
142-
except exception.InstanceUnknownCell as e:
143-
raise exc.HTTPNotFound(explanation=e.format_message())
144142
except (exception.NoValidHost,
145143
exception.ComputeServiceUnavailable,
146144
exception.InvalidHypervisorType,

nova/api/openstack/compute/multinic.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def _add_fixed_ip(self, req, id, body):
4747
network_id = body['addFixedIp']['networkId']
4848
try:
4949
self.compute_api.add_fixed_ip(context, instance, network_id)
50-
except exception.InstanceUnknownCell as e:
51-
raise exc.HTTPNotFound(explanation=e.format_message())
5250
except exception.NoMoreFixedIps as e:
5351
raise exc.HTTPBadRequest(explanation=e.format_message())
5452

@@ -67,7 +65,5 @@ def _remove_fixed_ip(self, req, id, body):
6765

6866
try:
6967
self.compute_api.remove_fixed_ip(context, instance, address)
70-
except exception.InstanceUnknownCell as e:
71-
raise exc.HTTPNotFound(explanation=e.format_message())
7268
except exception.FixedIpNotFoundForSpecificInstance as e:
7369
raise exc.HTTPBadRequest(explanation=e.format_message())

nova/api/openstack/compute/pause_server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def _pause(self, req, id, body):
4444
except exception.InstanceInvalidState as state_error:
4545
common.raise_http_conflict_for_instance_invalid_state(state_error,
4646
'pause', id)
47-
except (exception.InstanceUnknownCell,
48-
exception.InstanceNotFound) as e:
47+
except exception.InstanceNotFound as e:
4948
raise exc.HTTPNotFound(explanation=e.format_message())
5049
except NotImplementedError:
5150
common.raise_feature_not_supported()
@@ -65,8 +64,7 @@ def _unpause(self, req, id, body):
6564
except exception.InstanceInvalidState as state_error:
6665
common.raise_http_conflict_for_instance_invalid_state(state_error,
6766
'unpause', id)
68-
except (exception.InstanceUnknownCell,
69-
exception.InstanceNotFound) as e:
67+
except exception.InstanceNotFound as e:
7068
raise exc.HTTPNotFound(explanation=e.format_message())
7169
except NotImplementedError:
7270
common.raise_feature_not_supported()

nova/api/openstack/compute/remote_consoles.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def get_vnc_console(self, req, id, body):
5252
console_type)
5353
except exception.ConsoleTypeUnavailable as e:
5454
raise webob.exc.HTTPBadRequest(explanation=e.format_message())
55-
except (exception.InstanceUnknownCell,
56-
exception.InstanceNotFound) as e:
55+
except exception.InstanceNotFound as e:
5756
raise webob.exc.HTTPNotFound(explanation=e.format_message())
5857
except exception.InstanceNotReady as e:
5958
raise webob.exc.HTTPConflict(explanation=e.format_message())
@@ -81,8 +80,7 @@ def get_spice_console(self, req, id, body):
8180
console_type)
8281
except exception.ConsoleTypeUnavailable as e:
8382
raise webob.exc.HTTPBadRequest(explanation=e.format_message())
84-
except (exception.InstanceUnknownCell,
85-
exception.InstanceNotFound) as e:
83+
except exception.InstanceNotFound as e:
8684
raise webob.exc.HTTPNotFound(explanation=e.format_message())
8785
except exception.InstanceNotReady as e:
8886
raise webob.exc.HTTPConflict(explanation=e.format_message())
@@ -112,8 +110,7 @@ def get_rdp_console(self, req, id, body):
112110
console_type)
113111
except exception.ConsoleTypeUnavailable as e:
114112
raise webob.exc.HTTPBadRequest(explanation=e.format_message())
115-
except (exception.InstanceUnknownCell,
116-
exception.InstanceNotFound) as e:
113+
except exception.InstanceNotFound as e:
117114
raise webob.exc.HTTPNotFound(explanation=e.format_message())
118115
except exception.InstanceNotReady as e:
119116
raise webob.exc.HTTPConflict(explanation=e.format_message())
@@ -138,8 +135,7 @@ def get_serial_console(self, req, id, body):
138135
output = self.compute_api.get_serial_console(context,
139136
instance,
140137
console_type)
141-
except (exception.InstanceUnknownCell,
142-
exception.InstanceNotFound) as e:
138+
except exception.InstanceNotFound as e:
143139
raise webob.exc.HTTPNotFound(explanation=e.format_message())
144140
except exception.InstanceNotReady as e:
145141
raise webob.exc.HTTPConflict(explanation=e.format_message())

nova/api/openstack/compute/rescue.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ def _rescue(self, req, id, body):
6161
self.compute_api.rescue(context, instance,
6262
rescue_password=password,
6363
rescue_image_ref=rescue_image_ref)
64-
except exception.InstanceUnknownCell as e:
65-
raise exc.HTTPNotFound(explanation=e.format_message())
6664
except exception.InstanceIsLocked as e:
6765
raise exc.HTTPConflict(explanation=e.format_message())
6866
except exception.InstanceInvalidState as state_error:
@@ -89,8 +87,6 @@ def _unrescue(self, req, id, body):
8987
instance = common.get_instance(self.compute_api, context, id)
9088
try:
9189
self.compute_api.unrescue(context, instance)
92-
except exception.InstanceUnknownCell as e:
93-
raise exc.HTTPNotFound(explanation=e.format_message())
9490
except exception.InstanceIsLocked as e:
9591
raise exc.HTTPConflict(explanation=e.format_message())
9692
except exception.InstanceInvalidState as state_error:

nova/api/openstack/compute/server_metadata.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,10 @@ def _update_instance_metadata(self, context, server_id, metadata,
108108
server,
109109
metadata,
110110
delete)
111-
112-
except exception.InstanceUnknownCell as e:
113-
raise exc.HTTPNotFound(explanation=e.format_message())
114-
115111
except exception.QuotaError as error:
116112
raise exc.HTTPForbidden(explanation=error.format_message())
117-
118113
except exception.InstanceIsLocked as e:
119114
raise exc.HTTPConflict(explanation=e.format_message())
120-
121115
except exception.InstanceInvalidState as state_error:
122116
common.raise_http_conflict_for_instance_invalid_state(state_error,
123117
'update metadata', server_id)
@@ -150,13 +144,8 @@ def delete(self, req, server_id, id):
150144
server = common.get_instance(self.compute_api, context, server_id)
151145
try:
152146
self.compute_api.delete_instance_metadata(context, server, id)
153-
154-
except exception.InstanceUnknownCell as e:
155-
raise exc.HTTPNotFound(explanation=e.format_message())
156-
157147
except exception.InstanceIsLocked as e:
158148
raise exc.HTTPConflict(explanation=e.format_message())
159-
160149
except exception.InstanceInvalidState as state_error:
161150
common.raise_http_conflict_for_instance_invalid_state(state_error,
162151
'delete metadata', server_id)

nova/api/openstack/compute/servers.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,6 @@ def _action_confirm_resize(self, req, id, body):
852852
instance = self._get_server(context, req, id)
853853
try:
854854
self.compute_api.confirm_resize(context, instance)
855-
except exception.InstanceUnknownCell as e:
856-
raise exc.HTTPNotFound(explanation=e.format_message())
857855
except exception.MigrationNotFound:
858856
msg = _("Instance has not been resized.")
859857
raise exc.HTTPBadRequest(explanation=msg)
@@ -872,8 +870,6 @@ def _action_revert_resize(self, req, id, body):
872870
instance = self._get_server(context, req, id)
873871
try:
874872
self.compute_api.revert_resize(context, instance)
875-
except exception.InstanceUnknownCell as e:
876-
raise exc.HTTPNotFound(explanation=e.format_message())
877873
except exception.MigrationNotFound:
878874
msg = _("Instance has not been resized.")
879875
raise exc.HTTPBadRequest(explanation=msg)
@@ -927,8 +923,6 @@ def _resize(self, req, instance_id, flavor_id, **kwargs):
927923

928924
try:
929925
self.compute_api.resize(context, instance, flavor_id, **kwargs)
930-
except exception.InstanceUnknownCell as e:
931-
raise exc.HTTPNotFound(explanation=e.format_message())
932926
except exception.QuotaError as error:
933927
raise exc.HTTPForbidden(
934928
explanation=error.format_message())
@@ -967,8 +961,6 @@ def delete(self, req, id):
967961
except exception.InstanceNotFound:
968962
msg = _("Instance could not be found")
969963
raise exc.HTTPNotFound(explanation=msg)
970-
except exception.InstanceUnknownCell as e:
971-
raise exc.HTTPNotFound(explanation=e.format_message())
972964
except (exception.InstanceIsLocked,
973965
exception.AllocationDeleteFailed) as e:
974966
raise exc.HTTPConflict(explanation=e.format_message())
@@ -1093,8 +1085,6 @@ def _action_rebuild(self, req, id, body):
10931085
except exception.InstanceNotFound:
10941086
msg = _("Instance could not be found")
10951087
raise exc.HTTPNotFound(explanation=msg)
1096-
except exception.InstanceUnknownCell as e:
1097-
raise exc.HTTPNotFound(explanation=e.format_message())
10981088
except exception.ImageNotFound:
10991089
msg = _("Cannot find image for rebuild")
11001090
raise exc.HTTPBadRequest(explanation=msg)
@@ -1188,8 +1178,6 @@ def _action_create_image(self, req, id, body):
11881178
instance,
11891179
image_name,
11901180
extra_properties=metadata)
1191-
except exception.InstanceUnknownCell as e:
1192-
raise exc.HTTPNotFound(explanation=e.format_message())
11931181
except exception.InstanceInvalidState as state_error:
11941182
common.raise_http_conflict_for_instance_invalid_state(state_error,
11951183
'createImage', id)
@@ -1262,8 +1250,6 @@ def _start_server(self, req, id, body):
12621250
self.compute_api.start(context, instance)
12631251
except (exception.InstanceNotReady, exception.InstanceIsLocked) as e:
12641252
raise webob.exc.HTTPConflict(explanation=e.format_message())
1265-
except exception.InstanceUnknownCell as e:
1266-
raise exc.HTTPNotFound(explanation=e.format_message())
12671253
except exception.InstanceInvalidState as state_error:
12681254
common.raise_http_conflict_for_instance_invalid_state(state_error,
12691255
'start', id)
@@ -1282,8 +1268,6 @@ def _stop_server(self, req, id, body):
12821268
self.compute_api.stop(context, instance)
12831269
except (exception.InstanceNotReady, exception.InstanceIsLocked) as e:
12841270
raise webob.exc.HTTPConflict(explanation=e.format_message())
1285-
except exception.InstanceUnknownCell as e:
1286-
raise exc.HTTPNotFound(explanation=e.format_message())
12871271
except exception.InstanceInvalidState as state_error:
12881272
common.raise_http_conflict_for_instance_invalid_state(state_error,
12891273
'stop', id)

nova/api/openstack/compute/shelve.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ def _shelve(self, req, id, body):
4545
'project_id': instance.project_id})
4646
try:
4747
self.compute_api.shelve(context, instance)
48-
except exception.InstanceUnknownCell as e:
49-
raise exc.HTTPNotFound(explanation=e.format_message())
5048
except exception.InstanceIsLocked as e:
5149
raise exc.HTTPConflict(explanation=e.format_message())
5250
except exception.InstanceInvalidState as state_error:
@@ -64,8 +62,6 @@ def _shelve_offload(self, req, id, body):
6462
instance = common.get_instance(self.compute_api, context, id)
6563
try:
6664
self.compute_api.shelve_offload(context, instance)
67-
except exception.InstanceUnknownCell as e:
68-
raise exc.HTTPNotFound(explanation=e.format_message())
6965
except exception.InstanceIsLocked as e:
7066
raise exc.HTTPConflict(explanation=e.format_message())
7167
except exception.InstanceInvalidState as state_error:
@@ -98,8 +94,6 @@ def _unshelve(self, req, id, body):
9894

9995
try:
10096
self.compute_api.unshelve(context, instance)
101-
except exception.InstanceUnknownCell as e:
102-
raise exc.HTTPNotFound(explanation=e.format_message())
10397
except exception.InstanceIsLocked as e:
10498
raise exc.HTTPConflict(explanation=e.format_message())
10599
except exception.InstanceInvalidState as state_error:

nova/api/openstack/compute/suspend_server.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ def _suspend(self, req, id, body):
3838
target={'user_id': server.user_id,
3939
'project_id': server.project_id})
4040
self.compute_api.suspend(context, server)
41-
except exception.InstanceUnknownCell as e:
42-
raise exc.HTTPNotFound(explanation=e.format_message())
4341
except exception.InstanceIsLocked as e:
4442
raise exc.HTTPConflict(explanation=e.format_message())
4543
except exception.InstanceInvalidState as state_error:
@@ -56,8 +54,6 @@ def _resume(self, req, id, body):
5654
server = common.get_instance(self.compute_api, context, id)
5755
try:
5856
self.compute_api.resume(context, server)
59-
except exception.InstanceUnknownCell as e:
60-
raise exc.HTTPNotFound(explanation=e.format_message())
6157
except exception.InstanceIsLocked as e:
6258
raise exc.HTTPConflict(explanation=e.format_message())
6359
except exception.InstanceInvalidState as state_error:

nova/api/openstack/compute/volumes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,7 @@ def create(self, req, server_id, body):
335335
device = self.compute_api.attach_volume(
336336
context, instance, volume_id, device, tag=tag,
337337
supports_multiattach=supports_multiattach)
338-
except (exception.InstanceUnknownCell,
339-
exception.VolumeNotFound) as e:
338+
except exception.VolumeNotFound as e:
340339
raise exc.HTTPNotFound(explanation=e.format_message())
341340
except (exception.InstanceIsLocked,
342341
exception.DevicePathInUse,
@@ -448,8 +447,6 @@ def delete(self, req, server_id, id):
448447
self.compute_api.detach_volume(context, instance, volume)
449448
except exception.InvalidVolume as e:
450449
raise exc.HTTPBadRequest(explanation=e.format_message())
451-
except exception.InstanceUnknownCell as e:
452-
raise exc.HTTPNotFound(explanation=e.format_message())
453450
except exception.InvalidInput as e:
454451
raise exc.HTTPBadRequest(explanation=e.format_message())
455452
except exception.InstanceIsLocked as e:

nova/tests/unit/api/openstack/compute/test_deferred_delete.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,6 @@ def test_force_delete_instance_notfound(self, mock_force_delete, mock_get):
104104
self.assertIn('Instance fake_uuid could not be found',
105105
ex.explanation)
106106

107-
@mock.patch.object(compute_api.API, 'get')
108-
@mock.patch.object(compute_api.API, 'force_delete',
109-
side_effect=exception.InstanceUnknownCell(
110-
instance_uuid='fake_uuid'))
111-
def test_force_delete_instance_cellunknown(self, mock_force_delete,
112-
mock_get):
113-
req = fakes.HTTPRequest.blank('/v2/fake/servers/fake_uuid/action')
114-
ex = self.assertRaises(webob.exc.HTTPNotFound,
115-
self.extension._force_delete,
116-
req, 'fake_uuid', '')
117-
self.assertIn('Cell is not known for instance fake_uuid',
118-
ex.explanation)
119-
120107
@mock.patch.object(compute_api.API, 'get')
121108
@mock.patch.object(compute_api.API, 'restore')
122109
def test_restore(self, mock_restore, mock_get):

0 commit comments

Comments
 (0)