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