Do not ignore OverQuota errors from neutronclient

Before is_conflict method of out neutron client plugin was checking if
the error code of the exception raised by neutronclient is 409
(conflict).

It fact there are several other exceptions raised by neutronclient
with the same error code, OverQuotaClient exception included [1], that are
better to reraise and fail the resource/stack than silently to ignore.

This patch stops ignoring OverQuota exception specifically.

[1]
https://github.com/openstack/python-neutronclient/blob/master/neutronclient/common/exceptions.py#L147

Change-Id: Iacd3f416e9e651c53c18130f77564d85fd49d7d4
Closes-Bug: #1403092
This commit is contained in:
Pavlo Shchelokovskyy 2014-12-17 13:56:01 +00:00
parent 8a0f41e9e3
commit 127d11ac70
4 changed files with 15 additions and 16 deletions

View File

@ -54,9 +54,9 @@ class NeutronClientPlugin(client_plugin.ClientPlugin):
ex.status_code == 404)
def is_conflict(self, ex):
if not isinstance(ex, exceptions.NeutronClientException):
return False
return ex.status_code == 409
bad_conflicts = (exceptions.OverQuotaClient,)
return (isinstance(ex, exceptions.Conflict) and
not isinstance(ex, bad_conflicts))
def is_over_limit(self, ex):
if not isinstance(ex, exceptions.NeutronClientException):

View File

@ -465,8 +465,7 @@ class TestIsNotFound(common.HeatTestCase):
is_client_exception=True,
is_conflict=True,
plugin='neutron',
exception=lambda: neutron_exc.NeutronClientException(
status_code=409),
exception=lambda: neutron_exc.Conflict(),
)),
('nova_not_found', dict(
is_not_found=True,

View File

@ -569,7 +569,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'ingress',
@ -582,7 +582,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'ingress',
@ -595,7 +595,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.show_security_group('aaaa').AndReturn({
'security_group': {
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
@ -617,7 +617,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'egress',
@ -630,7 +630,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'egress',
@ -643,7 +643,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
# delete script
neutronclient.Client.show_security_group('aaaa').AndReturn({

View File

@ -747,7 +747,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'ingress',
@ -760,7 +760,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'ingress',
@ -773,7 +773,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'egress',
@ -786,7 +786,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
neutronclient.Client.create_security_group_rule({
'security_group_rule': {
'direction': 'egress',
@ -799,7 +799,7 @@ Resources:
'security_group_id': 'aaaa'
}
}).AndRaise(
neutron_exc.NeutronClientException(status_code=409))
neutron_exc.Conflict())
# delete script
neutronclient.Client.show_security_group('aaaa').AndReturn({