protected void activatePorts(Instance instance, ProcessState state) { for (Port port : getObjectManager().children(instance, Port.class)) { // ports can be removed while instance is still present (lb instance is an example) if (port.getRemoved() == null && !(port.getState().equalsIgnoreCase(CommonStatesConstants.REMOVED) || port.getState() .equalsIgnoreCase(CommonStatesConstants.REMOVING))) { createThenActivate(port, state.getData()); } } }
protected void processPorts(Instance instance) { Set<String> portSpecs = new HashSet<>(); for (Port port : objectManager.children(instance, Port.class)) { if (port.getRemoved() != null) { continue; } portSpecs.add(new PortSpec(port).toSpec()); } objectManager.setFields(instance, InstanceConstants.FIELD_PORTS, new ArrayList<>(portSpecs)); Event event = EventVO.newEvent(IaasEvents.INVALIDATE_INSTANCE_DATA_CACHE) .withResourceType(instance.getKind()) .withResourceId(instance.getId().toString()); eventService.publish(event); }
protected void network(Instance instance) { List<Nic> nics = getObjectManager().children(instance, Nic.class); for (Nic nic : nics) { if (nic.getRemoved() == null && !nic.getState().equals(CommonStatesConstants.REMOVED)) { deactivate(nic, null); } } for (Port port : getObjectManager().children(instance, Port.class)) { if (port.getRemoved() == null && !port.getState().equals(CommonStatesConstants.REMOVED)) { deactivate(port, null); } } for (InstanceLink link : getObjectManager().children(instance, InstanceLink.class, InstanceLinkConstants.FIELD_INSTANCE_ID)) { if (link.getRemoved() == null && !link.getState().equals(CommonStatesConstants.REMOVED)) { deactivate(link, null); } } }
if (port.getRemoved() != null || port.getState().equalsIgnoreCase(CommonStatesConstants.REMOVING)) { continue;
if (port.getRemoved() != null) { continue;
/** * {@inheritDoc} */ @Override public void from(io.cattle.platform.core.model.Port from) { setId(from.getId()); setName(from.getName()); setAccountId(from.getAccountId()); setKind(from.getKind()); setUuid(from.getUuid()); setDescription(from.getDescription()); setState(from.getState()); setCreated(from.getCreated()); setRemoved(from.getRemoved()); setRemoveTime(from.getRemoveTime()); setData(from.getData()); setPublicPort(from.getPublicPort()); setPrivatePort(from.getPrivatePort()); setInstanceId(from.getInstanceId()); setPublicIpAddressId(from.getPublicIpAddressId()); setProtocol(from.getProtocol()); setPrivateIpAddressId(from.getPrivateIpAddressId()); }