Ensure namespace network resources are deleted even on subnet not found
OpenStackSDK is raising a SDKException when a subnet does not
exist, causing the controller to continuosly restart.
This commit protects from such scenario by ignoring when
such exception happens with certain message.
Closes-bug:
@@ -102,10 +102,16 @@ class NamespacePodSubnetDriver(default_subnet.DefaultPodSubnetDriver):
# or subnet is already detached.
LOG.debug(e.message)
pass
- except os_exc.SDKException:
- LOG.exception("Error deleting subnet %(subnet)s from router "
- "%(router)s.",
- {'subnet': subnet_id, 'router': router_id})
+ except os_exc.SDKException as e:
+ # FIXME(maysams): Rely only on the NotFoundException handling
+ # when the bug fixed at 704998 is merged.
+ if "could not be found" in str(e.message):
+ LOG.debug(e.message)
+ else:
+ LOG.exception(
+ "Error deleting subnet %(subnet)s from router "
+ "%(router)s.", {'subnet': subnet_id, 'router':
+ router_id})
raise
try:
