Search in sources :

Example 1 with NetworkParameters

use of org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkParameters 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)

Example 2 with NetworkParameters

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

the class LogicalNetworkModelParametersHelper method storeAttachmentParamsBeforeDetach.

private void storeAttachmentParamsBeforeDetach() {
    NetworkAttachment networkAttachment = networkModel.getNetworkAttachment();
    if (networkAttachment == null) {
        return;
    }
    NetworkParameters netParams = new NetworkParameters();
    IPv4Address ipv4Address = networkAttachment.getIpConfiguration().getIpv4PrimaryAddress();
    if (ipv4Address != null) {
        netParams.setIpv4BootProtocol(ipv4Address.getBootProtocol());
        netParams.setIpv4Address(ipv4Address.getAddress());
        netParams.setIpv4Netmask(ipv4Address.getNetmask());
        netParams.setIpv4Gateway(ipv4Address.getGateway());
    }
    IpV6Address ipv6Address = networkAttachment.getIpConfiguration().getIpv6PrimaryAddress();
    if (ipv6Address != null) {
        netParams.setIpv6BootProtocol(ipv6Address.getBootProtocol());
        netParams.setIpv6Address(ipv6Address.getAddress());
        netParams.setIpv6Prefix(ipv6Address.getPrefix());
        netParams.setIpv6Gateway(ipv6Address.getGateway());
    }
    netParams.setHostNetworkQos(HostNetworkQos.fromAnonymousHostNetworkQos(networkAttachment.getHostNetworkQos()));
    netParams.setQosOverridden(networkAttachment.isQosOverridden());
    netParams.setCustomProperties(networkAttachment.getProperties());
    netParams.setDnsResolverConfiguration(networkAttachment.getDnsResolverConfiguration());
    networkModel.getSetupModel().getNetworkToLastDetachParams().put(networkModel.getName(), netParams);
}
Also used : NetworkParameters(org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkParameters) IpV6Address(org.ovirt.engine.core.common.businessentities.network.IpV6Address) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Aggregations

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