Search in sources :

Example 1 with BondMode

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

the class VdsBrokerObjectsBuilder method normalizeBondOptions.

private static String normalizeBondOptions(String bondOptions) {
    Matcher matcher = Pattern.compile("mode=([\\w-\\.]+)").matcher(bondOptions);
    if (!matcher.find()) {
        return bondOptions;
    }
    BondMode bondMode = BondMode.getBondMode(matcher.group(1));
    if (bondMode != null) {
        return matcher.replaceAll("mode=" + bondMode.getValue());
    }
    return bondOptions;
}
Also used : Matcher(java.util.regex.Matcher) BondMode(org.ovirt.engine.core.common.businessentities.network.BondMode)

Example 2 with BondMode

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

the class AsyncDataProvider method getBondingOptionListDependingOnNetwork.

public ArrayList<Map.Entry<String, EntityModel<String>>> getBondingOptionListDependingOnNetwork(RefObject<Map.Entry<String, EntityModel<String>>> defaultItem, boolean hasVmNetworkAttached) {
    ArrayList<Map.Entry<String, EntityModel<String>>> list = new ArrayList<>();
    for (BondMode mode : BondMode.values()) {
        if (!mode.isBondModeValidForVmNetwork() && hasVmNetworkAttached) {
            continue;
        }
        KeyValuePairCompat<String, EntityModel<String>> bondOption = getBondOption(mode);
        list.add(bondOption);
        if (mode.equals(BondMode.BOND4)) {
            defaultItem.argvalue = bondOption;
        }
    }
    EntityModel<String> entityModel = new EntityModel<>();
    // $NON-NLS-1$
    entityModel.setEntity("");
    list.add(new KeyValuePairCompat<>(SetupNetworksBondModel.CUSTOM_BONDING_MODE, entityModel));
    return list;
}
Also used : ProfileEntry(org.ovirt.engine.core.aaa.ProfileEntry) Entry(java.util.Map.Entry) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) BondMode(org.ovirt.engine.core.common.businessentities.network.BondMode)

Aggregations

BondMode (org.ovirt.engine.core.common.businessentities.network.BondMode)2 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1 Matcher (java.util.regex.Matcher)1 ProfileEntry (org.ovirt.engine.core.aaa.ProfileEntry)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1