use of org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration in project ovirt-engine by oVirt.
the class NetworkInSyncWithVdsNetworkInterfaceTest method reverseNameServersOrder.
private DnsResolverConfiguration reverseNameServersOrder(DnsResolverConfiguration sampleDnsResolverConfiguration) {
List<NameServer> reversedNameServers = sampleDnsResolverConfiguration.getNameServers();
Collections.reverse(reversedNameServers);
DnsResolverConfiguration result = new DnsResolverConfiguration();
result.setNameServers(reversedNameServers);
return result;
}
use of org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilder method setDnsResolverConfigurationData.
private static void setDnsResolverConfigurationData(VDS vds, Map<String, Object> struct) {
String[] nameServersAddresses = assignStringArrayValue(struct, VdsProperties.name_servers);
if (nameServersAddresses != null) {
List<NameServer> nameServers = Stream.of(nameServersAddresses).map(NameServer::new).collect(Collectors.toList());
DnsResolverConfiguration reportedDnsResolverConfiguration = new DnsResolverConfiguration();
reportedDnsResolverConfiguration.setNameServers(nameServers);
DnsResolverConfiguration oldDnsResolverConfiguration = vds.getReportedDnsResolverConfiguration();
if (oldDnsResolverConfiguration != null) {
reportedDnsResolverConfiguration.setId(oldDnsResolverConfiguration.getId());
}
vds.getDynamicData().setReportedDnsResolverConfiguration(reportedDnsResolverConfiguration);
}
}
use of org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration in project ovirt-engine by oVirt.
the class DnsConfigurationModel method flush.
public DnsResolverConfiguration flush() {
Boolean shouldSetDnsConfiguration = this.shouldSetDnsConfiguration.getEntity();
if (!shouldSetDnsConfiguration) {
return null;
}
List<NameServer> nameServers = new ArrayList<>();
for (NameServerModel nameServerModel : this.nameServerModelListModel.getItems()) {
nameServers.add(new NameServer(nameServerModel.flush()));
}
DnsResolverConfiguration result = new DnsResolverConfiguration();
result.setNameServers(nameServers);
if (getEntity() != null) {
result.setId(getEntity().getId());
}
return result;
}
use of org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration in project ovirt-engine by oVirt.
the class HostSetupNetworksCommand method calculateNetworksToConfigure.
private List<HostNetwork> calculateNetworksToConfigure() {
List<HostNetwork> networksToConfigure = new ArrayList<>(getParameters().getNetworkAttachments().size());
BusinessEntityMap<VdsNetworkInterface> nics = getExistingNicsBusinessEntityMap();
for (NetworkAttachment attachment : getAttachmentsWithMissingUpdatedDefaultRoute()) {
Network network = existingNetworkRelatedToAttachment(attachment);
NetworkCluster networkCluster = network.getCluster();
HostNetwork networkToConfigure = new HostNetwork(network, attachment);
networkToConfigure.setBonding(isBonding(attachment, nics));
boolean isDefaultRoute = defaultRouteSupported() && networkCluster.isDefaultRoute();
if (isDefaultRoute) {
DnsResolverConfiguration dnsResolverConfiguration = getDnsConfigurationFromNetworkOrItsAttachment(attachment, network);
if (dnsResolverConfiguration != null) {
networkToConfigure.setNameServers(dnsResolverConfiguration.getNameServers());
}
}
// TODO: YZ - should default route be set separately for IPv4 and IPv6
networkToConfigure.setDefaultRoute(isDefaultRoute);
if (NetworkUtils.qosConfiguredOnInterface(attachment, network)) {
networkToConfigure.setQosConfiguredOnInterface(true);
HostNetworkQos hostNetworkQos = effectiveHostNetworkQos.getQos(attachment, network);
networkToConfigure.setQos(hostNetworkQos);
}
networksToConfigure.add(networkToConfigure);
}
return networksToConfigure;
}
use of org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration in project ovirt-engine by oVirt.
the class HostSetupNetworksCommand method getDnsConfigurationFromNetworkOrItsAttachment.
private DnsResolverConfiguration getDnsConfigurationFromNetworkOrItsAttachment(NetworkAttachment attachment, Network network) {
DnsResolverConfiguration networkAttachmentDnsResolverConfiguration = attachment.getDnsResolverConfiguration();
if (networkAttachmentDnsResolverConfiguration != null) {
return networkAttachmentDnsResolverConfiguration;
}
DnsResolverConfiguration networkDnsResolverConfiguration = network.getDnsResolverConfiguration();
if (networkDnsResolverConfiguration != null) {
return networkDnsResolverConfiguration;
}
return null;
}
Aggregations