change error code and message due to Amazon changes
Amazon changed error code some time ago. Change-Id: Ib5eb94f3a5bbdb27bc4ead5898376f274dd6e5c3
This commit is contained in:
parent
bb89039e9b
commit
8d1a61ce6c
|
@ -118,8 +118,7 @@ def create_network_interface(context, subnet_id,
|
|||
os_port = neutron.create_port(os_port_body)['port']
|
||||
except (neutron_exception.IpAddressGenerationFailureClient,
|
||||
neutron_exception.OverQuotaClient):
|
||||
raise exception.NetworkInterfaceLimitExceeded(
|
||||
subnet_id=subnet_id)
|
||||
raise exception.InsufficientFreeAddressesInSubnet()
|
||||
except (neutron_exception.IpAddressInUseClient,
|
||||
neutron_exception.BadRequest) as ex:
|
||||
# NOTE(ft): AWS returns InvalidIPAddress.InUse for a primary IP
|
||||
|
@ -279,8 +278,7 @@ def assign_private_ip_addresses(context, network_interface_id,
|
|||
neutron.update_port(os_port['id'],
|
||||
{'port': {'fixed_ips': fixed_ips}})
|
||||
except neutron_exception.IpAddressGenerationFailureClient:
|
||||
raise exception.NetworkInterfaceLimitExceeded(
|
||||
subnet_id=subnet['id'])
|
||||
raise exception.InsufficientFreeAddressesInSubnet()
|
||||
except neutron_exception.IpAddressInUseClient:
|
||||
msg = _('Some of %(addresses)s is assigned, but move is not '
|
||||
'allowed.') % {'addresses': private_ip_address}
|
||||
|
|
|
@ -462,9 +462,9 @@ class SubnetLimitExceeded(EC2OverlimitException):
|
|||
'can create')
|
||||
|
||||
|
||||
class NetworkInterfaceLimitExceeded(EC2OverlimitException):
|
||||
msg_fmt = _('You have reached the limit of network interfaces for subnet'
|
||||
'%(subnet_id)s.')
|
||||
class InsufficientFreeAddressesInSubnet(EC2OverlimitException):
|
||||
msg_fmt = _('The specified subnet does not have enough free addresses to '
|
||||
'satisfy the request.')
|
||||
|
||||
|
||||
class AddressLimitExceeded(EC2OverlimitException):
|
||||
|
|
|
@ -142,7 +142,8 @@ class NetworkInterfaceTest(base.EC2TestCase):
|
|||
SubnetId=self.subnet_id)
|
||||
except botocore.exceptions.ClientError as e:
|
||||
error_code = e.response['Error']['Code']
|
||||
self.assertEqual('NetworkInterfaceLimitExceeded', error_code)
|
||||
self.assertEqual('InsufficientFreeAddressesInSubnet',
|
||||
error_code, e.message)
|
||||
break
|
||||
ni_id = data['NetworkInterface']['NetworkInterfaceId']
|
||||
res_clean = self.addResourceCleanUp(
|
||||
|
|
|
@ -239,7 +239,7 @@ class NetworkInterfaceTestCase(base.ApiTestCase):
|
|||
self.neutron.create_port.side_effect = cls()
|
||||
do_check({'SubnetId': fakes.ID_EC2_SUBNET_1,
|
||||
'PrivateIpAddress': fakes.IP_NETWORK_INTERFACE_1},
|
||||
'NetworkInterfaceLimitExceeded')
|
||||
'InsufficientFreeAddressesInSubnet')
|
||||
|
||||
for cls in [neutron_exception.IpAddressInUseClient,
|
||||
neutron_exception.BadRequest]:
|
||||
|
@ -656,7 +656,7 @@ class NetworkInterfaceTestCase(base.ApiTestCase):
|
|||
|
||||
self.neutron.update_port.side_effect = (
|
||||
neutron_exception.IpAddressGenerationFailureClient())
|
||||
do_check('NetworkInterfaceLimitExceeded')
|
||||
do_check('InsufficientFreeAddressesInSubnet')
|
||||
|
||||
self.neutron.update_port.side_effect = (
|
||||
neutron_exception.IpAddressInUseClient())
|
||||
|
|
Loading…
Reference in New Issue