Search in sources :

Example 1 with InterfacePropertiesAccessor

use of org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor in project ovirt-engine by oVirt.

the class LogicalNetworkModelParametersHelper method createAttachmentWhenAttachingTo.

private NetworkAttachment createAttachmentWhenAttachingTo(VdsNetworkInterface targetNic) {
    NetworkAttachment networkAttachment = new NetworkAttachment(targetNic, networkModel.getNetwork(), NetworkCommonUtils.createDefaultIpConfiguration());
    NetworkParameters netParams = networkModel.getSetupModel().getNetworkToLastDetachParams().get(networkModel.getName());
    if (netParams != null) {
        applyOnAttachmentParamsFrom(netParams, networkAttachment);
    } else {
        VdsNetworkInterface nicToTakeParamsFrom = null;
        if (networkModel.hasVlan()) {
            nicToTakeParamsFrom = getPotentialVlanDevice(targetNic);
        } else {
            nicToTakeParamsFrom = targetNic;
        }
        boolean newlyCreatedBond = nicToTakeParamsFrom != null && nicToTakeParamsFrom.getId() == null;
        if (nicToTakeParamsFrom != null && !newlyCreatedBond) {
            InterfacePropertiesAccessor.FromNic interfacePropertiesAccessor = new InterfacePropertiesAccessor.FromNic(nicToTakeParamsFrom, null);
            applyOnAttachmentParamsFrom(interfacePropertiesAccessor, networkAttachment);
        }
        fixBootProtocolOfMgmtNetworkIfNeeded(networkAttachment);
    }
    return networkAttachment;
}
Also used : InterfacePropertiesAccessor(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor) NetworkParameters(org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkParameters) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Aggregations

NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 InterfacePropertiesAccessor (org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor)1 NetworkParameters (org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkParameters)1