Search in sources :

Example 11 with DnsResolverConfiguration

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

the class DnsResolverConfigurationDaoTest method dnsResolverConfigurationFromFixtures.

public DnsResolverConfiguration dnsResolverConfigurationFromFixtures() {
    DnsResolverConfiguration expected = new DnsResolverConfiguration();
    expected.setId(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION);
    expected.setNameServers(Arrays.asList(new NameServer("192.168.1.2"), new NameServer("2002:0db8:85a3:0000:0000:8a2e:0370:7334")));
    return expected;
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 12 with DnsResolverConfiguration

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

the class HostSetupNetworksModel method onEdit.

public void onEdit(NetworkItemModel<?> item) {
    Model editPopup = null;
    BaseCommandTarget okTarget = null;
    if (item instanceof BondNetworkInterfaceModel) {
        /**
         ***************
         * Bond Dialog
         ****************
         */
        boolean doesBondHaveVmNetworkAttached = doesBondHaveVmNetworkAttached((NetworkInterfaceModel) item);
        BondNetworkInterfaceModel bondModel = (BondNetworkInterfaceModel) item;
        final CreateOrUpdateBond createOrUpdateBondParameter = bondModel.getCreateOrUpdateBond();
        editPopup = new SetupNetworksEditBondModel(createOrUpdateBondParameter, doesBondHaveVmNetworkAttached);
        final SetupNetworksBondModel bondDialogModel = (SetupNetworksBondModel) editPopup;
        // OK Target
        okTarget = new BaseCommandTarget() {

            @Override
            public void executeCommand(UICommand command) {
                if (!bondDialogModel.validate()) {
                    return;
                }
                sourceListModel.setConfirmWindow(null);
                setBondOptions(createOrUpdateBondParameter, bondDialogModel);
                redraw();
            }
        };
    } else if (item instanceof NetworkInterfaceModel) {
        /**
         *****************
         * VFs Config Dialog
         ******************
         */
        final VdsNetworkInterface entity = ((NetworkInterfaceModel) item).getOriginalIface();
        final HostNicVfsConfig hostNicVfsConfig = nicToVfsConfig.get(entity.getId());
        if (hostNicVfsConfig != null) {
            final VfsConfigModel vfsConfigPopupModel = new VfsConfigModel(hostNicVfsConfig, allNetworks, dcLabels);
            vfsConfigPopupModel.setTitle(ConstantsManager.getInstance().getMessages().editHostNicVfsConfigTitle(entity.getName()));
            editPopup = vfsConfigPopupModel;
            // OK Target
            okTarget = new BaseCommandTarget() {

                @Override
                public void executeCommand(UICommand uiCommand) {
                    if (!vfsConfigPopupModel.validate()) {
                        return;
                    }
                    sourceListModel.setConfirmWindow(null);
                    commitVfsConfigChanges(hostNicVfsConfig, vfsConfigPopupModel);
                    redraw();
                }
            };
        }
    } else if (item instanceof LogicalNetworkModel) {
        /**
         ***************
         * Network Dialog
         ****************
         */
        final LogicalNetworkModel logicalNetworkModel = (LogicalNetworkModel) item;
        final VdsNetworkInterface nic;
        if (logicalNetworkModel.isInSync()) {
            nic = logicalNetworkModel.hasVlan() ? logicalNetworkModel.getVlanDevice() : logicalNetworkModel.getAttachedToNic().getOriginalIface();
        } else {
            nic = logicalNetworkModel.getVlanDevice() != null ? logicalNetworkModel.getVlanDevice() : logicalNetworkModel.getAttachedToNic().getOriginalIface();
        }
        final NetworkAttachmentModel networkAttachmentModel;
        String version = getEntity().getClusterCompatibilityVersion().getValue();
        final Network network = logicalNetworkModel.getNetwork();
        final String logicalNetworkModelName = network.getName();
        final NetworkAttachment networkAttachment = logicalNetworkModel.getNetworkAttachment();
        HostNetworkQos networkQos = qosById.get(network.getQosId());
        DnsResolverConfiguration reportedDnsResolverConfiguration = getEntity().getReportedDnsResolverConfiguration();
        if (logicalNetworkModel.isManagement()) {
            networkAttachmentModel = new ManagementNetworkAttachmentModel(network, nic, networkAttachment, networkQos, reportedDnsResolverConfiguration);
        } else {
            networkAttachmentModel = new NetworkAttachmentModel(network, nic, networkAttachment, networkQos, reportedDnsResolverConfiguration);
            networkAttachmentModel.getIpv4Gateway().setIsAvailable(true);
            networkAttachmentModel.getIpv6Gateway().setIsAvailable(false);
        }
        networkAttachmentModel.getQosOverridden().setIsAvailable(true);
        networkAttachmentModel.getQosModel().setIsAvailable(true);
        KeyValueModel customPropertiesModel = networkAttachmentModel.getCustomPropertiesModel();
        customPropertiesModel.setIsAvailable(true);
        Map<String, String> validProperties = KeyValueModel.convertProperties((String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.PreDefinedNetworkCustomProperties, version));
        // to backend and frontend (lvernia)
        if (!network.isVmNetwork()) {
            // $NON-NLS-1$
            validProperties.remove("bridge_opts");
        }
        validProperties.putAll(KeyValueModel.convertProperties((String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.UserDefinedNetworkCustomProperties, version)));
        customPropertiesModel.setKeyValueMap(validProperties);
        customPropertiesModel.deserialize(KeyValueModel.convertProperties(networkAttachment.getProperties()));
        networkAttachmentModel.getIsToSync().setIsChangeable(!logicalNetworkModel.isInSync());
        networkAttachmentModel.getIsToSync().setEntity(shouldSyncNetwork(logicalNetworkModelName));
        networkAttachmentModel.getQosOverridden().setEntity(networkAttachment.isQosOverridden());
        editPopup = networkAttachmentModel;
        // OK Target
        okTarget = new BaseCommandTarget() {

            @Override
            public void executeCommand(UICommand command) {
                if (!networkAttachmentModel.validate()) {
                    return;
                }
                final FromNetworkAttachmentModel interfacePropertiesAccessor = new FromNetworkAttachmentModel(networkAttachmentModel);
                LogicalNetworkModelParametersHelper.populateIpv4Details(interfacePropertiesAccessor, networkAttachment.getIpConfiguration().getIpv4PrimaryAddress());
                LogicalNetworkModelParametersHelper.populateIpv6Details(interfacePropertiesAccessor, networkAttachment.getIpConfiguration().getIpv6PrimaryAddress());
                if (networkAttachmentModel.getQosModel().getIsAvailable()) {
                    if (networkAttachmentModel.getQosOverridden().getEntity()) {
                        HostNetworkQos overriddenQos = new HostNetworkQos();
                        networkAttachmentModel.getQosModel().flush(overriddenQos);
                        AnonymousHostNetworkQos hostNetworkQos = fromHostNetworkQos(overriddenQos);
                        networkAttachment.setHostNetworkQos(hostNetworkQos);
                    } else {
                        networkAttachment.setHostNetworkQos(null);
                    }
                }
                if (networkAttachmentModel.getIsToSync().getEntity()) {
                    hostSetupNetworksParametersData.getNetworksToSync().add(logicalNetworkModelName);
                } else {
                    hostSetupNetworksParametersData.getNetworksToSync().remove(logicalNetworkModelName);
                }
                boolean customPropertiesAvailable = networkAttachmentModel.getCustomPropertiesModel().getIsAvailable();
                Map<String, String> customProperties = customPropertiesAvailable ? KeyValueModel.convertProperties(networkAttachmentModel.getCustomPropertiesModel().serialize()) : null;
                networkAttachment.setProperties(customProperties);
                networkAttachment.setDnsResolverConfiguration(networkAttachmentModel.getDnsConfigurationModel().flush());
                sourceListModel.setConfirmWindow(null);
                redraw();
            }
        };
    }
    // ok command
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OK", okTarget);
    // cancel command
    UICommand cancelCommand = new UICommand("Cancel", new // $NON-NLS-1$
    BaseCommandTarget() {

        @Override
        public void executeCommand(UICommand command) {
            sourceListModel.setConfirmWindow(null);
        }
    });
    cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().cancel());
    cancelCommand.setIsCancel(true);
    if (editPopup != null) {
        editPopup.getCommands().add(okCommand);
        editPopup.getCommands().add(cancelCommand);
    }
    sourceListModel.setConfirmWindow(editPopup);
}
Also used : AnonymousHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos) AnonymousHostNetworkQos.fromHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos.fromHostNetworkQos) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) FromNetworkAttachmentModel(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor.FromNetworkAttachmentModel) BaseCommandTarget(org.ovirt.engine.ui.uicommonweb.BaseCommandTarget) Network(org.ovirt.engine.core.common.businessentities.network.Network) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) AnonymousHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos) HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) LogicalNetworkModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel) FromNetworkAttachmentModel(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor.FromNetworkAttachmentModel) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) DataFromHostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.DataFromHostSetupNetworksModel) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) LogicalNetworkModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel) NewNetworkLabelModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel.NewNetworkLabelModel) FromNetworkAttachmentModel(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor.FromNetworkAttachmentModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) NetworkItemModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel) NetworkLabelModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) Map(java.util.Map) HashMap(java.util.HashMap)

Example 13 with DnsResolverConfiguration

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

the class VDS method clone.

public VDS clone() {
    VDS vds = new VDS();
    vds.setClusterId(getClusterId());
    vds.setClusterCpuName(getClusterCpuName());
    vds.setCpuName(getCpuName());
    vds.setClusterDescription(getClusterDescription());
    vds.setId(getId());
    vds.setVdsName(getName());
    vds.setHostName(getHostName());
    vds.setComment(getComment());
    vds.setPort(getPort());
    vds.setSshPort(getSshPort());
    vds.setSshUsername(getSshUsername());
    vds.setStatus(getStatus());
    vds.setExternalStatus(getExternalStatus());
    vds.setHardwareManufacturer(getHardwareManufacturer());
    vds.setHardwareProductName(getHardwareProductName());
    vds.setHardwareVersion(getHardwareVersion());
    vds.setHardwareSerialNumber(getHardwareSerialNumber());
    vds.setHardwareUUID(getHardwareUUID());
    vds.setHardwareFamily(getHardwareFamily());
    vds.setCpuCores(getCpuCores());
    vds.setCpuThreads(getCpuThreads());
    vds.setCpuModel(getCpuModel());
    vds.setOnlineCpus(getOnlineCpus());
    vds.setCpuSpeedMh(getCpuSpeedMh());
    vds.setIfTotalSpeed(getIfTotalSpeed());
    vds.setKvmEnabled(getKvmEnabled());
    vds.setPhysicalMemMb(getPhysicalMemMb());
    vds.setCpuIdle(getCpuIdle());
    vds.setCpuLoad(getCpuLoad());
    vds.setCpuSys(getCpuSys());
    vds.setCpuUser(getCpuUser());
    vds.setMemCommited(getMemCommited());
    vds.setVmActive(getVmActive());
    vds.setVmCount(getVmCount());
    vds.setVmMigrating(getVmMigrating());
    vds.setUsageMemPercent(getUsageMemPercent());
    vds.setUsageCpuPercent(getUsageCpuPercent());
    vds.setUsageNetworkPercent(getUsageNetworkPercent());
    vds.setReservedMem(getReservedMem());
    vds.setBootTime(getBootTime());
    vds.setGuestOverhead(getGuestOverhead());
    vds.setPreviousStatus(getPreviousStatus());
    vds.setMemAvailable(getMemAvailable());
    vds.setMemShared(getMemShared());
    vds.setSoftwareVersion(getSoftwareVersion());
    vds.setVersionName(getVersionName());
    vds.setVersion(getVersion());
    vds.setServerSslEnabled(isServerSslEnabled());
    vds.setCpuFlags(getCpuFlags());
    vds.setNetConfigDirty(getNetConfigDirty());
    vds.setPmEnabled(isPmEnabled());
    vds.setPmKdumpDetection(isPmKdumpDetection());
    vds.setConsoleAddress(getConsoleAddress());
    vds.setHBAs(getHBAs());
    vds.setVdsSpmPriority(getVdsSpmPriority());
    vds.setOtpValidity(getOtpValidity());
    vds.setKernelVersion(getKernelVersion());
    vds.setKvmVersion(getKvmVersion());
    vds.setLibvirtVersion(getLibvirtVersion());
    vds.setGlusterfsCliVersion(getGlusterfsCliVersion());
    vds.setGlusterVersion(getGlusterVersion());
    vds.setLibrbdVersion(getLibrbdVersion());
    vds.setHooksStr(getHooksStr());
    vds.setActiveNic(getActiveNic());
    vds.setPowerManagementControlledByPolicy(isPowerManagementControlledByPolicy());
    vds.setDisablePowerManagementPolicy(isDisablePowerManagementPolicy());
    vds.setHighlyAvailableScore(getHighlyAvailableScore());
    vds.setHighlyAvailableIsConfigured(getHighlyAvailableIsConfigured());
    vds.setHighlyAvailableIsActive(getHighlyAvailableIsActive());
    vds.setHighlyAvailableGlobalMaintenance(getHighlyAvailableGlobalMaintenance());
    vds.setHighlyAvailableLocalMaintenance(getHighlyAvailableLocalMaintenance());
    vds.setBalloonEnabled(isBalloonEnabled());
    vds.setNumaNodeList(getNumaNodeList());
    vds.setAutoNumaBalancing(getAutoNumaBalancing());
    vds.setFenceAgents(getFenceAgents());
    vds.setClusterCompatibilityVersion(getClusterCompatibilityVersion());
    vds.setUpdateAvailable(isUpdateAvailable());
    vds.setHostDevicePassthroughEnabled(isHostDevicePassthroughEnabled());
    vds.setHostedEngineHost(isHostedEngineHost());
    vds.setCurrentKernelCmdline(getCurrentKernelCmdline());
    vds.setLastStoredKernelCmdline(getLastStoredKernelCmdline());
    vds.setKernelCmdlineParsable(isKernelCmdlineParsable());
    vds.setKernelCmdlineBlacklistNouveau(isKernelCmdlineBlacklistNouveau());
    vds.setKernelCmdlineIommu(isKernelCmdlineIommu());
    vds.setKernelCmdlineKvmNested(isKernelCmdlineKvmNested());
    vds.setKernelCmdlinePciRealloc(isKernelCmdlinePciRealloc());
    vds.setKernelCmdlineUnsafeInterrupts(isKernelCmdlineUnsafeInterrupts());
    vds.setGlusterPeerStatus(getGlusterPeerStatus());
    vds.setKernelFeatures(getKernelFeatures());
    DnsResolverConfiguration originalDnsResolverConfiguration = getReportedDnsResolverConfiguration();
    if (originalDnsResolverConfiguration != null) {
        vds.setReportedDnsResolverConfiguration(new DnsResolverConfiguration(originalDnsResolverConfiguration));
    }
    vds.setInFenceFlow(isInFenceFlow());
    return vds;
}
Also used : DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 14 with DnsResolverConfiguration

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

the class NetworkAttachmentDaoImpl method update.

@Override
public void update(NetworkAttachment entity) {
    verifyRelationWithHostNetworkQos(entity);
    hostNetworkQosDao.persistQosChanges(entity.getId(), asHostNetworkQos(entity.getHostNetworkQos()));
    DnsResolverConfiguration dnsResolverConfiguration = entity.getDnsResolverConfiguration();
    if (dnsResolverConfiguration == null) {
        dnsResolverConfigurationDao.removeByNetworkAttachmentId(entity.getId());
    } else {
        if (dnsResolverConfiguration.getId() == null) {
            dnsResolverConfigurationDao.save(dnsResolverConfiguration);
        } else {
            dnsResolverConfigurationDao.update(dnsResolverConfiguration);
        }
    }
    super.update(entity);
}
Also used : DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 15 with DnsResolverConfiguration

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

the class NetworkDaoImpl method update.

@Override
public void update(Network entity) {
    DnsResolverConfiguration dnsResolverConfiguration = entity.getDnsResolverConfiguration();
    if (dnsResolverConfiguration == null) {
        dnsResolverConfigurationDao.removeByNetworkId(entity.getId());
    } else {
        if (dnsResolverConfiguration.getId() == null) {
            dnsResolverConfigurationDao.save(dnsResolverConfiguration);
        } else {
            dnsResolverConfigurationDao.update(dnsResolverConfiguration);
        }
    }
    super.update(entity);
}
Also used : DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Aggregations

DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)19 NameServer (org.ovirt.engine.core.common.businessentities.network.NameServer)9 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)5 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)2 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)2 EffectiveHostNetworkQos (org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos)2 Map (java.util.Map)1 Test (org.junit.Test)1 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 AnonymousHostNetworkQos (org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos)1