Search in sources :

Example 21 with VmInitNetwork

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

the class InitializationMapper method map.

@Mapping(from = Initialization.class, to = VmInit.class)
public static VmInit map(Initialization model, VmInit template) {
    VmInit entity = template != null ? template : new VmInit();
    boolean someSubTagSet = false;
    if (model.isSetHostName()) {
        someSubTagSet = true;
        entity.setHostname(model.getHostName());
    }
    if (model.isSetDomain()) {
        someSubTagSet = true;
        entity.setDomain(model.getDomain());
    }
    if (model.isSetTimezone()) {
        someSubTagSet = true;
        entity.setTimeZone(model.getTimezone());
    }
    if (model.isSetAuthorizedSshKeys()) {
        someSubTagSet = true;
        entity.setAuthorizedKeys(model.getAuthorizedSshKeys());
    }
    if (model.isSetRegenerateSshKeys()) {
        someSubTagSet = true;
        entity.setRegenerateKeys(model.isRegenerateSshKeys());
    }
    if (model.isSetDnsServers()) {
        someSubTagSet = true;
        entity.setDnsServers(model.getDnsServers());
    }
    if (model.isSetDnsSearch()) {
        someSubTagSet = true;
        entity.setDnsSearch(model.getDnsSearch());
    }
    if (model.isSetWindowsLicenseKey()) {
        someSubTagSet = true;
        entity.setWinKey(model.getWindowsLicenseKey());
    }
    if (model.isSetRootPassword()) {
        someSubTagSet = true;
        entity.setRootPassword(model.getRootPassword());
    }
    if (model.isSetCustomScript()) {
        someSubTagSet = true;
        entity.setCustomScript(model.getCustomScript());
    }
    if (model.isSetNicConfigurations()) {
        someSubTagSet = true;
        List<VmInitNetwork> networks = new ArrayList<>();
        for (NicConfiguration nic : model.getNicConfigurations().getNicConfigurations()) {
            networks.add(map(nic, null));
        }
        entity.setNetworks(networks);
    }
    if (model.isSetInputLocale()) {
        someSubTagSet = true;
        entity.setInputLocale(model.getInputLocale());
    }
    if (model.isSetUiLanguage()) {
        someSubTagSet = true;
        entity.setUiLanguage(model.getUiLanguage());
    }
    if (model.isSetSystemLocale()) {
        someSubTagSet = true;
        entity.setSystemLocale(model.getSystemLocale());
    }
    if (model.isSetUserLocale()) {
        someSubTagSet = true;
        entity.setUserLocale(model.getUserLocale());
    }
    if (model.isSetUserName()) {
        someSubTagSet = true;
        entity.setUserName(model.getUserName());
    }
    if (model.isSetActiveDirectoryOu()) {
        someSubTagSet = true;
        entity.setActiveDirectoryOU(model.getActiveDirectoryOu());
    }
    if (model.isSetOrgName()) {
        someSubTagSet = true;
        entity.setOrgName(model.getOrgName());
    }
    if (model.isSetCloudInit()) {
        someSubTagSet = true;
        VmMapper.map(model.getCloudInit(), entity);
    }
    if (!someSubTagSet) {
        return null;
    }
    return entity;
}
Also used : VmInit(org.ovirt.engine.core.common.businessentities.VmInit) VmInitNetwork(org.ovirt.engine.core.common.businessentities.VmInitNetwork) ArrayList(java.util.ArrayList) NicConfiguration(org.ovirt.engine.api.model.NicConfiguration)

Example 22 with VmInitNetwork

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

the class VmInitModel method addNetwork.

private void addNetwork() {
    if (!networkMap.containsKey(newNetworkText)) {
        networkMap.put(newNetworkText, new VmInitNetwork());
        getNetworkList().setItems(new ArrayList<>(networkMap.keySet()));
    }
    getNetworkList().setSelectedItem(newNetworkText);
}
Also used : VmInitNetwork(org.ovirt.engine.core.common.businessentities.VmInitNetwork)

Example 23 with VmInitNetwork

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

the class VmInitModel method updateNetworkDisplay.

/* Update displayed network properties to reflect currently-selected item */
private void updateNetworkDisplay() {
    String networkName = null;
    VmInitNetwork vmInitNetwork = null;
    if (getNetworkList().getSelectedItem() != null) {
        networkName = getNetworkList().getSelectedItem();
        vmInitNetwork = networkMap.get(networkName);
    }
    final Ipv4BootProtocol ipv4bootProtocol = vmInitNetwork == null || vmInitNetwork.getBootProtocol() == null ? Ipv4BootProtocol.NONE : vmInitNetwork.getBootProtocol();
    getIpv4BootProtocolList().setSelectedItem(ipv4bootProtocol);
    final Ipv6BootProtocol ipv6bootProtocol = vmInitNetwork == null || vmInitNetwork.getIpv6BootProtocol() == null ? Ipv6BootProtocol.NONE : vmInitNetwork.getIpv6BootProtocol();
    getIpv6BootProtocolList().setSelectedItem(ipv6bootProtocol);
    getNetworkIpAddress().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIp());
    getNetworkNetmask().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getNetmask());
    getNetworkGateway().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getGateway());
    getNetworkIpv6Address().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Address());
    getNetworkIpv6Prefix().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Prefix());
    getNetworkIpv6Gateway().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Gateway());
    hardCodeStartOnBoot();
}
Also used : VmInitNetwork(org.ovirt.engine.core.common.businessentities.VmInitNetwork) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)

Aggregations

VmInitNetwork (org.ovirt.engine.core.common.businessentities.VmInitNetwork)23 VmInit (org.ovirt.engine.core.common.businessentities.VmInit)13 Pair (org.ovirt.engine.core.common.utils.Pair)10 Map (java.util.Map)3 ArrayList (java.util.ArrayList)2 SortedMap (java.util.SortedMap)2 TreeMap (java.util.TreeMap)2 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)2 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 AuthorizedKey (org.ovirt.engine.api.model.AuthorizedKey)1 File (org.ovirt.engine.api.model.File)1 Host (org.ovirt.engine.api.model.Host)1 Nic (org.ovirt.engine.api.model.Nic)1 NicConfiguration (org.ovirt.engine.api.model.NicConfiguration)1 User (org.ovirt.engine.api.model.User)1 Ipv6BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)1 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)1 HostAddressValidation (org.ovirt.engine.ui.uicommonweb.validation.HostAddressValidation)1 HostnameValidation (org.ovirt.engine.ui.uicommonweb.validation.HostnameValidation)1