Search in sources :

Example 26 with VmTemplate

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

the class NewVmModelBehavior method oSType_SelectedItemChanged.

@Override
public void oSType_SelectedItemChanged() {
    super.oSType_SelectedItemChanged();
    VmTemplate template = getModel().getTemplateWithVersion().getSelectedItem() == null ? null : getModel().getTemplateWithVersion().getSelectedItem().getTemplateVersion();
    Integer osType = getModel().getOSType().getSelectedItem();
    if ((template != null || !basedOnCustomInstanceType()) && osType != null) {
        Guid id = basedOnCustomInstanceType() ? template.getId() : getModel().getInstanceTypes().getSelectedItem().getId();
        updateVirtioScsiEnabledWithoutDetach(id, osType);
    }
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Guid(org.ovirt.engine.core.compat.Guid)

Example 27 with VmTemplate

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

the class PoolModelBehaviorBase method setImagesToModel.

@Override
protected void setImagesToModel(UnitVmModel model, List<RepoImage> images) {
    if (getModel().getTemplateWithVersion().getSelectedItem() == null) {
        return;
    }
    VmTemplate template = getModel().getTemplateWithVersion().getSelectedItem().getTemplateVersion();
    model.getCdImage().setItems(images);
    if (!StringHelper.isNullOrEmpty(template.getIsoPath())) {
        RepoImage oldCdImage = images.stream().filter(i -> i.getRepoImageId().equals(template.getIsoPath())).findFirst().orElse(null);
        model.getCdImage().setSelectedItem(oldCdImage);
    }
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 28 with VmTemplate

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

the class PoolModelBehaviorBase method oSType_SelectedItemChanged.

@Override
public void oSType_SelectedItemChanged() {
    super.oSType_SelectedItemChanged();
    VmTemplate template = getModel().getTemplateWithVersion().getSelectedItem() == null ? null : getModel().getTemplateWithVersion().getSelectedItem().getTemplateVersion();
    Integer osType = getModel().getOSType().getSelectedItem();
    if ((template != null || !basedOnCustomInstanceType()) && osType != null) {
        Guid id = basedOnCustomInstanceType() ? template.getId() : getModel().getInstanceTypes().getSelectedItem().getId();
        updateVirtioScsiEnabledWithoutDetach(id, osType);
    }
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Guid(org.ovirt.engine.core.compat.Guid)

Example 29 with VmTemplate

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

the class PoolModelBehaviorBase method postDataCenterWithClusterSelectedItemChanged.

@Override
public void postDataCenterWithClusterSelectedItemChanged() {
    updateDefaultHost();
    updateCustomPropertySheet();
    updateMinAllocatedMemory();
    updateNumOfSockets();
    updateOSValues();
    if (getModel().getTemplateWithVersion().getSelectedItem() != null) {
        VmTemplate template = getModel().getTemplateWithVersion().getSelectedItem().getTemplateVersion();
        updateQuotaByCluster(template.getQuotaId(), template.getQuotaName());
    }
    updateMemoryBalloon();
    updateCpuSharesAvailability();
    updateVirtioScsiAvailability();
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 30 with VmTemplate

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

the class ExistingPoolModelBehavior method templateWithVersion_SelectedItemChanged.

@Override
public void templateWithVersion_SelectedItemChanged() {
    super.templateWithVersion_SelectedItemChanged();
    getModel().setIsDisksAvailable(true);
    VmTemplate template = getModel().getTemplateWithVersion().getSelectedItem().getTemplateVersion();
    if (template == null) {
        return;
    }
    boolean isLatestPropertyChanged = pool.isUseLatestVersion() != (template instanceof LatestVmTemplate);
    // template ID changed but latest is not set, as it would cause false-positives
    boolean isTemplateIdChangedSinceInit = !pool.getVmtGuid().equals(template.getId()) && !pool.isUseLatestVersion();
    // check if template-version selected requires to manually load the model instead of using the InstanceTypeManager
    if (isTemplateIdChangedSinceInit || isLatestPropertyChanged) {
        setupWindowFromVmBase(template);
    } else {
        setupWindowFromVmBase(pool.getStaticData());
        // can be set only from DB since it is not part of the Template's fields
        getModel().getCpuPinning().setEntity(pool.getCpuPinning());
    }
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) LatestVmTemplate(org.ovirt.engine.ui.uicommonweb.models.templates.LatestVmTemplate) LatestVmTemplate(org.ovirt.engine.ui.uicommonweb.models.templates.LatestVmTemplate)

Aggregations

VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)149 ArrayList (java.util.ArrayList)42 Guid (org.ovirt.engine.core.compat.Guid)40 Test (org.junit.Test)30 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)23 HashMap (java.util.HashMap)22 List (java.util.List)20 VM (org.ovirt.engine.core.common.businessentities.VM)19 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)16 Map (java.util.Map)13 QueryType (org.ovirt.engine.core.common.queries.QueryType)13 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)12 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)11 Frontend (org.ovirt.engine.ui.frontend.Frontend)10 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)9 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)9 Collection (java.util.Collection)8 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)8