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;
}
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);
}
Aggregations