Search in sources :

Example 1 with DisplayInterfaceEqualityPredicate

use of org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicate in project ovirt-engine by oVirt.

the class HostNetworkTopologyPersisterImpl method logChangedDisplayNetwork.

private void logChangedDisplayNetwork(VDS host, Collection<Network> engineHostNetworks, Collection<VdsNetworkInterface> engineInterfaces) {
    if (isVmRunningOnHost(host.getId())) {
        final Network engineDisplayNetwork = findDisplayNetwork(host.getClusterId(), engineHostNetworks);
        if (engineDisplayNetwork == null) {
            return;
        }
        final IsNetworkOnInterfacePredicate isNetworkOnInterfacePredicate = new IsNetworkOnInterfacePredicate(engineDisplayNetwork.getName());
        final VdsNetworkInterface vdsmDisplayInterface = host.getInterfaces().stream().filter(isNetworkOnInterfacePredicate).findFirst().orElse(null);
        final VdsNetworkInterface engineDisplayInterface = engineInterfaces.stream().filter(isNetworkOnInterfacePredicate).findFirst().orElse(null);
        final DisplayInterfaceEqualityPredicate displayIneterfaceEqualityPredicate = new DisplayInterfaceEqualityPredicate(engineDisplayInterface);
        if (// the display interface is't on host anymore
        vdsmDisplayInterface == null || !displayIneterfaceEqualityPredicate.test(vdsmDisplayInterface)) {
            final AuditLogable loggable = createAuditLogForHost(host);
            auditLogDirector.log(loggable, AuditLogType.NETWORK_UPDATE_DISPLAY_FOR_HOST_WITH_ACTIVE_VM);
        }
    }
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Network(org.ovirt.engine.core.common.businessentities.network.Network) DisplayInterfaceEqualityPredicate(org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicate) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) IsNetworkOnInterfacePredicate(org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.IsNetworkOnInterfacePredicate)

Aggregations

Network (org.ovirt.engine.core.common.businessentities.network.Network)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1 DisplayInterfaceEqualityPredicate (org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.DisplayInterfaceEqualityPredicate)1 IsNetworkOnInterfacePredicate (org.ovirt.engine.core.vdsbroker.vdsbroker.predicates.IsNetworkOnInterfacePredicate)1