Search in sources :

Example 36 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class HostSetupNetworksCommand method getExistingInterfacesAndNewlyCreatedBonds.

private List<VdsNetworkInterface> getExistingInterfacesAndNewlyCreatedBonds() {
    List<VdsNetworkInterface> nicsToConfigure = new ArrayList<>();
    nicsToConfigure.addAll(interfaceDao.getAllInterfacesForVds(getVdsId()));
    for (CreateOrUpdateBond createOrUpdateBond : getParameters().getCreateOrUpdateBonds()) {
        if (createOrUpdateBond.getId() == null) {
            Bond newBond = new Bond(createOrUpdateBond.getName());
            nicsToConfigure.add(newBond);
        }
    }
    return nicsToConfigure;
}
Also used : ArrayList(java.util.ArrayList) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Bond(org.ovirt.engine.core.common.businessentities.network.Bond)

Example 37 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class HostSetupNetworksValidator method validateBondModeVsNetworksAttachedToIt.

protected ValidationResult validateBondModeVsNetworksAttachedToIt(Collection<NetworkAttachment> attachmentsToConfigure) {
    Map<String, VdsNetworkInterface> hostInterfacesByNetworkName = NetworkUtils.hostInterfacesByNetworkName(existingInterfaces);
    for (NetworkAttachment attachment : attachmentsToConfigure) {
        if (!mustAttachementBeCheckedForBondMode(attachment, hostInterfacesByNetworkName)) {
            continue;
        }
        CreateOrUpdateBond bondToCheck = createOrUpdateBondBusinessEntityMap.get(attachment.getNicName());
        if (bondToCheck == null) {
            VdsNetworkInterface existingNetworkInterfaceForAttachement = existingInterfacesMap.get(attachment.getNicName());
            if (existingNetworkInterfaceForAttachement == null || !existingNetworkInterfaceForAttachement.isBond()) {
                continue;
            }
            bondToCheck = CreateOrUpdateBond.fromBond((Bond) existingNetworkInterfaceForAttachement);
        }
        String networkLabel = networkBusinessEntityMap.get(attachment.getNetworkName()).getLabel();
        ValidationResult validationResult = checkBondMode(bondToCheck, networkLabel, attachment.getNetworkName());
        if (!validationResult.isValid()) {
            return validationResult;
        }
    }
    return ValidationResult.VALID;
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Bond(org.ovirt.engine.core.common.businessentities.network.Bond) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 38 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class ItemInfoPopup method showNic.

private void showNic(NetworkInterfaceModel nic) {
    contents.removeAllRows();
    VdsNetworkInterface entity = nic.getOriginalIface();
    addRow(templates.titleSetupNetworkTooltip(nic.getName(), SafeStylesUtils.forTrustedBackgroundColor(BACKGROUND_COLOR)));
    if (nic.getItems().isEmpty() && !nic.isBonded()) {
        insertHorizontalLine();
        addMtuInfo(entity.getMtu());
        addBootProtoAndIpInfo(new InterfacePropertiesAccessor.FromNic(entity, null));
    }
    if (nic instanceof BondNetworkInterfaceModel) {
        CreateOrUpdateBond createOrUpdateBond = ((BondNetworkInterfaceModel) nic).getCreateOrUpdateBond();
        String bondOptions = entity.getBondOptions();
        if (createOrUpdateBond != null) {
            bondOptions = createOrUpdateBond.getBondOptions();
        }
        addRow(constants.bondOptionsItemInfo(), // $NON-NLS-1$
        bondOptions.replace(BOND_OPTIONS_IP_SEPARATOR, BOND_OPTIONS_IP_SEPARATOR + " "));
    } else {
        addLldpInfo(nic);
    }
    if (nic.isVf()) {
        addRow(constants.physicalFunction(), nic.getPhysicalFunction());
    }
}
Also used : InterfacePropertiesAccessor(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Aggregations

CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)38 Test (org.junit.Test)18 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)14 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)10 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)8 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)8 Guid (org.ovirt.engine.core.compat.Guid)6 HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)5 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)4 BondNetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Network (org.ovirt.engine.core.common.businessentities.network.Network)3 LogicalNetworkModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel)3 NetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel)3 List (java.util.List)2 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)2 NicLabel (org.ovirt.engine.core.common.businessentities.network.NicLabel)2 BaseCommandTarget (org.ovirt.engine.ui.uicommonweb.BaseCommandTarget)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2