\r
public class PortHandler implements TransactionChainListener {\r
\r
- private static final Logger LOG = LoggerFactory.getLogger(MappingProvider.class);\r
+ private static final Logger LOG = LoggerFactory.getLogger(PortHandler.class);\r
\r
private static final String COMPUTE_OWNER = "compute";\r
private static final String DHCP_OWNER = "dhcp";\r
private static final String ROUTER_OWNER = "network:router_interface";\r
private static final String[] SUPPORTED_DEVICE_OWNERS = {COMPUTE_OWNER, DHCP_OWNER, ROUTER_OWNER};\r
private static final String VHOST_USER = "vhostuser";\r
+ private static final String UNBOUND = "unbound";\r
private static final String VPP_INTERFACE_NAME_PREFIX = "neutron_port_";\r
private static final String TAP_PORT_NAME_PREFIX = "tap";\r
private static final String RT_PORT_NAME_PREFIX = "qr-";\r
processCreated(delta);\r
}\r
\r
- private boolean isUpdateNeeded(Port oldPort, Port newPort) {\r
+ private boolean isUpdateNeeded(final Port oldPort, final Port newPort) {\r
//TODO fix this to better support update of ports for VPP\r
- PortBindingExtension oldPortAugmentation = oldPort.getAugmentation(PortBindingExtension.class);\r
- PortBindingExtension newPortAugmentation = newPort.getAugmentation(PortBindingExtension.class);\r
-\r
- List<VifDetails> vifDetails = oldPortAugmentation.getVifDetails();\r
+ final PortBindingExtension oldPortAugmentation = oldPort.getAugmentation(PortBindingExtension.class);\r
+ final PortBindingExtension newPortAugmentation = newPort.getAugmentation(PortBindingExtension.class);\r
\r
if (newPortAugmentation == null) {\r
LOG.trace("Port {} is no longer a vhost type port, updating port...");\r
return true;\r
}\r
\r
+ final String oldDeviceOwner = oldPort.getDeviceOwner();\r
+ final String oldVifType = oldPortAugmentation.getVifType();\r
+ final String newDeviceOwner = newPort.getDeviceOwner();\r
+ final String newVifType = newPortAugmentation.getVifType();\r
+\r
+ // TODO potential bug here\r
+ // Temporary change for Openstack Mitaka: If old neutron-binding:vif-type is vhost, new one is unbound and\r
+ // device owner is ROUTER_OWNER, skip update. Openstack (or ml2) sometimes sends router update messages in\r
+ // incorrect order which causes unwanted port removal\r
+ if (oldVifType.equals(VHOST_USER) && newVifType.equals(UNBOUND) && oldDeviceOwner != null &&\r
+ ROUTER_OWNER.equals(oldDeviceOwner) && ROUTER_OWNER.equals(newDeviceOwner)) {\r
+ LOG.warn("Port vif-type was updated from vhost to unbound. This update is currently disabled and will be skipped");\r
+ return false;\r
+ }\r
+\r
+ if (newVifType != null && !newVifType.equals(oldVifType)) {\r
+ LOG.trace("Vif type changed, old: {} new {}", oldVifType, newVifType);\r
+ return true;\r
+ }\r
+\r
+ final List<VifDetails> vifDetails = oldPortAugmentation.getVifDetails();\r
+\r
if (!oldPortAugmentation.getHostId().equals(newPortAugmentation.getHostId()) ||\r
nullToEmpty(vifDetails).size() != nullToEmpty(newPortAugmentation.getVifDetails()).size()) {\r
return true;\r