Avoid race between NP creation and pod annotation
This patch ensure that NPs are not applied to pods that have not
yet being annotated. This will avoid the race and the pods will
get their SG updated anyway when the annotation happens.
Closes-Bug:
@@ -95,12 +95,14 @@ class NeutronPodVIFDriver(base.PodVIFDriver):
def update_vif_sgs(self, pod, security_groups):
neutron = clients.get_neutron_client()
pod_state = utils.get_pod_state(pod)
+ if pod_state:
# NOTE(ltomasbo): It just updates the default_vif security group
port_id = pod_state.vifs[constants.DEFAULT_IFNAME].id
neutron.update_port(port_id,
{
"port": {
- 'security_groups': list(security_groups)
+ 'security_groups': list(
+ security_groups)
}
})
