Browse Source

Merge "Don't raise error when removing not existing IP address" into stable/queens

changes/72/726172/1
Zuul 2 months ago
committed by Gerrit Code Review
parent
commit
38f610579b
1 changed files with 15 additions and 6 deletions
  1. +15
    -6
      neutron/privileged/agent/linux/ip_lib.py

+ 15
- 6
neutron/privileged/agent/linux/ip_lib.py View File

@@ -139,12 +139,21 @@ def add_ip_address(ip_version, ip, prefixlen, device, namespace, scope,
@privileged.default.entrypoint
def delete_ip_address(ip_version, ip, prefixlen, device, namespace):
family = _IP_VERSION_FAMILY_MAP[ip_version]
_run_iproute_addr("delete",
device,
namespace,
address=ip,
mask=prefixlen,
family=family)
try:
_run_iproute_addr("delete",
device,
namespace,
address=ip,
mask=prefixlen,
family=family)
except NetlinkError as e:
# when trying to delete a non-existent IP address, pyroute2 raises
# NetlinkError with code EADDRNOTAVAIL (99, 'Cannot assign requested
# address')
# this shouldn't raise an error
if e.code == errno.EADDRNOTAVAIL:
return
raise


@privileged.default.entrypoint


Loading…
Cancel
Save