fixed_ips by vif does not raise
It makes more sense if this method returns an empty array instead of raising when it finds no ips. This lets the iteration over that array handle the 0 case, and we can use a conditional on the len(of the ips) if really needed. I'm not sure that log is needed to say "No fixed IPs deallocated" or if that is an artifact of needing something to put in the exception handler. Change-Id: Ib9f66affb5360fb11a3ab5f415a0e57602cec886
This commit is contained in:
parent
c7482e55d8
commit
6b51188b26
@ -416,9 +416,9 @@ def fixed_ip_get_by_network_host(context, network_id, host):
|
||||
return IMPL.fixed_ip_get_by_network_host(context, network_id, host)
|
||||
|
||||
|
||||
def fixed_ip_get_by_virtual_interface(context, vif_id):
|
||||
def fixed_ips_by_virtual_interface(context, vif_id):
|
||||
"""Get fixed ips by virtual interface or raise if none exist."""
|
||||
return IMPL.fixed_ip_get_by_virtual_interface(context, vif_id)
|
||||
return IMPL.fixed_ips_by_virtual_interface(context, vif_id)
|
||||
|
||||
|
||||
def fixed_ip_get_network(context, address):
|
||||
|
@ -876,15 +876,12 @@ def fixed_ip_get_by_network_host(context, network_id, host):
|
||||
|
||||
|
||||
@require_context
|
||||
def fixed_ip_get_by_virtual_interface(context, vif_id):
|
||||
def fixed_ips_by_virtual_interface(context, vif_id):
|
||||
result = model_query(context, models.FixedIp, read_deleted="no").\
|
||||
options(joinedload('floating_ips')).\
|
||||
filter_by(virtual_interface_id=vif_id).\
|
||||
all()
|
||||
|
||||
if not result:
|
||||
raise exception.FixedIpNotFoundForVirtualInterface(vif_id=vif_id)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user