Source:
private void extractNetwork(VdsNetworkInterface iface) { String networkName = iface.getNetworkName(); if (attachedNetworksNames.contains(networkName)) { addViolation(VdcBllMessages.NETWORKS_ALREADY_ATTACHED_TO_IFACES, networkName); } else { attachedNetworksNames.add(networkName); if (getExistingClusterNetworks().containsKey(networkName)) { Network network = getExistingClusterNetworks().get(networkName); validateNetworkInternal(network); validateNetworkExclusiveOnIface(iface, determineNetworkType(network.getVlanId(), network.isVmNetwork())); VdsNetworkInterface existingIface = getExistingIfaces().get(iface.getName()); if (existingIface != null && !networkName.equals(existingIface.getNetworkName())) { existingIface = getExistingIfaceByNetwork(networkName); } if (existingIface != null && existingIface.getNetworkImplementationDetails() != null && !existingIface.getNetworkImplementationDetails().isInSync()) { if (networkShouldBeSynced(networkName)) { modifiedNetworks.add(network); } else if (networkWasModified(iface)) { addViolation(VdcBllMessages.NETWORKS_NOT_IN_SYNC, networkName); } } else { if (networkWasModified(iface)) { if (networkIpAddressWasSameAsHostnameAndChanged(iface)) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_ADDRESS_CANNOT_BE_CHANGED, networkName); } modifiedNetworks.add(network); } if ((existingIface == null && iface.isQosOverridden()) || existingIface != null && (iface.isQosOverridden() != existingIface.isQosOverridden())) { modifiedInterfaces.add(iface); } } } else { VdsNetworkInterface existingIface = getExistingIfaces().get(iface.getName()); existingIface = (existingIface == null ? iface : existingIface); validateNetworkExclusiveOnIface(iface, determineNetworkType(existingIface.getVlanId(), existingIface.isBridged())); if (unmanagedNetworkChanged(iface)) { addViolation(VdcBllMessages.NETWORKS_DONT_EXIST_IN_CLUSTER, networkName); } } } }

Target:
private void extractNetwork(VdsNetworkInterface iface) { String networkName = iface.getNetworkName(); if (attachedNetworksNames.contains(networkName)) { addViolation(VdcBllMessages.NETWORKS_ALREADY_ATTACHED_TO_IFACES, networkName); } else { attachedNetworksNames.add(networkName); if (getExistingClusterNetworks().containsKey(networkName)) { Network network = getExistingClusterNetworks().get(networkName); validateNetworkInternal(network); validateNetworkExclusiveOnIface(iface, determineNetworkType(network.getVlanId(), network.isVmNetwork())); VdsNetworkInterface existingIface = getExistingIfaces().get(iface.getName()); if (existingIface != null && !networkName.equals(existingIface.getNetworkName())) { existingIface = getExistingIfaceByNetwork(networkName); } if (existingIface != null && existingIface.getNetworkImplementationDetails() != null && !existingIface.getNetworkImplementationDetails().isInSync()) { if (networkShouldBeSynced(networkName)) { modifiedNetworks.add(network); updateInterfaceIfNeeded(iface); } else if (networkWasModified(iface)) { addViolation(VdcBllMessages.NETWORKS_NOT_IN_SYNC, networkName); } } else { if (networkWasModified(iface)) { if (networkIpAddressWasSameAsHostnameAndChanged(iface)) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_ADDRESS_CANNOT_BE_CHANGED, networkName); } modifiedNetworks.add(network); } updateInterfaceIfNeeded(iface); } } else { VdsNetworkInterface existingIface = getExistingIfaces().get(iface.getName()); existingIface = (existingIface == null ? iface : existingIface); validateNetworkExclusiveOnIface(iface, determineNetworkType(existingIface.getVlanId(), existingIface.isBridged())); if (unmanagedNetworkChanged(iface)) { addViolation(VdcBllMessages.NETWORKS_DONT_EXIST_IN_CLUSTER, networkName); } } } }