Search in sources :

Example 6 with NetworkImplementationDetails

use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails in project ovirt-engine by oVirt.

the class HostNetworkTopologyPersisterImpl method logUnsynchronizedNetworks.

private void logUnsynchronizedNetworks(VDS host, Map<String, Network> networks) {
    List<String> networkNames = new ArrayList<>();
    for (VdsNetworkInterface iface : host.getInterfaces()) {
        Network network = networks.get(iface.getNetworkName());
        NetworkImplementationDetails networkImplementationDetails = networkImplementationDetailsUtils.calculateNetworkImplementationDetails(iface, network);
        if (networkImplementationDetails != null && !networkImplementationDetails.isInSync() && networkImplementationDetails.isManaged()) {
            networkNames.add(iface.getNetworkName());
        }
    }
    if (!networkNames.isEmpty()) {
        final AuditLogable logable = createAuditLogForHost(host);
        logable.addCustomValue("Networks", StringUtils.join(networkNames, ","));
        auditLogDirector.log(logable, AuditLogType.VDS_NETWORKS_OUT_OF_SYNC);
    }
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkImplementationDetails(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails)

Example 7 with NetworkImplementationDetails

use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails in project ovirt-engine by oVirt.

the class HostSetupNetworksCommand method getExistingNics.

private List<VdsNetworkInterface> getExistingNics() {
    if (existingNics == null) {
        existingNics = interfaceDao.getAllInterfacesForVds(getVdsId());
        NetworkCommonUtils.fillBondSlaves(existingNics);
        for (VdsNetworkInterface iface : existingNics) {
            Network network = getNetworkBusinessEntityMap().get(iface.getNetworkName());
            NetworkImplementationDetails networkImplementationDetails = networkImplementationDetailsUtils.calculateNetworkImplementationDetails(iface, network);
            iface.setNetworkImplementationDetails(networkImplementationDetails);
        }
    }
    return existingNics;
}
Also used : HostNetwork(org.ovirt.engine.core.common.vdscommands.HostNetwork) FindActiveVmsUsingNetwork(org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkImplementationDetails(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails)

Example 8 with NetworkImplementationDetails

use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails in project ovirt-engine by oVirt.

the class HostSetupNetworksValidator method mustAttachementBeCheckedForBondMode.

private boolean mustAttachementBeCheckedForBondMode(NetworkAttachment attachment, Map<String, VdsNetworkInterface> hostInterfacesByNetworkName) {
    Network network = networkBusinessEntityMap.get(attachment.getNetworkName());
    String networkName = attachment.getNetworkName();
    if (!network.isVmNetwork()) {
        return false;
    }
    VdsNetworkInterface nic = hostInterfacesByNetworkName.get(networkName);
    if (nic == null) {
        return true;
    }
    NetworkImplementationDetails networkImplementationDetails = nic.getNetworkImplementationDetails();
    return networkImplementationDetails == null || networkImplementationDetails.isInSync() || attachment.isOverrideConfiguration();
}
Also used : FindActiveVmsUsingNetwork(org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkImplementationDetails(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails)

Example 9 with NetworkImplementationDetails

use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails in project ovirt-engine by oVirt.

the class GetVdsAndNetworkInterfacesByNetworkIdQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    List<VDS> vdsList = vdsDao.getAllForNetwork(getParameters().getId());
    List<VdsNetworkInterface> vdsNetworkInterfaceList = interfaceDao.getVdsInterfacesByNetworkId(getParameters().getId());
    final Map<Guid, VDS> vdsById = Entities.businessEntitiesById(vdsList);
    List<PairQueryable<VdsNetworkInterface, VDS>> vdsInterfaceVdsPairs = new ArrayList<>();
    Network network = networkDao.get(getParameters().getId());
    for (final VdsNetworkInterface vdsNetworkInterface : vdsNetworkInterfaceList) {
        vdsInterfaceVdsPairs.add(new PairQueryable<>(vdsNetworkInterface, vdsById.get(vdsNetworkInterface.getVdsId())));
        NetworkImplementationDetails vdsInterfaceNetworkImplementationDetails = networkImplementationDetailsUtils.calculateNetworkImplementationDetails(vdsNetworkInterface, network);
        vdsNetworkInterface.setNetworkImplementationDetails(vdsInterfaceNetworkImplementationDetails);
    }
    getQueryReturnValue().setReturnValue(vdsInterfaceVdsPairs);
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) VDS(org.ovirt.engine.core.common.businessentities.VDS) Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) Guid(org.ovirt.engine.core.compat.Guid) NetworkImplementationDetails(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails)

Aggregations

NetworkImplementationDetails (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails)9 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)7 Network (org.ovirt.engine.core.common.businessentities.network.Network)6 ArrayList (java.util.ArrayList)3 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)3 Guid (org.ovirt.engine.core.compat.Guid)3 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)2 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)1 Nic (org.ovirt.engine.core.common.businessentities.network.Nic)1 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)1 HostNetwork (org.ovirt.engine.core.common.vdscommands.HostNetwork)1 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)1