use of org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder in project ovirt-engine by oVirt.
the class InstanceTypeListModel method postInstanceTypeNameUniqueCheck.
private void postInstanceTypeNameUniqueCheck() {
UnitVmModel model = (UnitVmModel) getWindow();
VM vm = new VM();
buildVmStatic(vm.getStaticData());
vm.setVmDescription(model.getDescription().getEntity());
AddVmTemplateParameters addInstanceTypeParameters = new AddVmTemplateParameters(vm, model.getName().getEntity(), model.getDescription().getEntity());
addInstanceTypeParameters.setTemplateType(VmEntityType.INSTANCE_TYPE);
addInstanceTypeParameters.setVmTemplateId(null);
addInstanceTypeParameters.setPublicUse(true);
addInstanceTypeParameters.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
addInstanceTypeParameters.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
addInstanceTypeParameters.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
addInstanceTypeParameters.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
if (model.getIsHeadlessModeEnabled().getEntity()) {
addInstanceTypeParameters.getVm().setDefaultDisplayType(DisplayType.none);
}
setVmWatchdogToParams(model, addInstanceTypeParameters);
setRngDeviceToParams(model, addInstanceTypeParameters);
BuilderExecutor.build(model, addInstanceTypeParameters, new UnitToGraphicsDeviceParamsBuilder());
getWindow().startProgress();
Frontend.getInstance().runAction(ActionType.AddVmTemplate, addInstanceTypeParameters, new UnitVmModelNetworkAsyncCallback(model, addInstanceTypeNetworkManager), this);
}
use of org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder in project ovirt-engine by oVirt.
the class TemplateListModel method postNameUniqueCheck.
public void postNameUniqueCheck() {
final UnitVmModel model = (UnitVmModel) getWindow();
if (model.getProgress() != null) {
return;
}
VmTemplate selectedItem;
if (model.getBehavior().isExistingTemplateBehavior()) {
selectedItem = ((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate();
} else {
selectedItem = ((ExistingBlankTemplateModelBehavior) model.getBehavior()).getVmTemplate();
}
final VmTemplate template = (VmTemplate) Cloner.clone(selectedItem);
final String iconForParameters = IconCache.getInstance().getIcon(selectedItem.getLargeIconId()).equals(model.getIcon().getEntity().getIcon()) ? null : IconUtils.filterPredefinedIcons(model.getIcon().getEntity().getIcon());
// Save changes.
buildTemplateOnSave(model, template);
template.setCreatedByUserId(selectedItem.getCreatedByUserId());
model.startProgress();
template.setVmInit(model.getVmInitModel().buildCloudInitParameters(model));
UpdateVmTemplateParameters parameters = new UpdateVmTemplateParameters(template);
parameters.setVmLargeIcon(iconForParameters);
parameters.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
setVmWatchdogToParams(model, parameters);
BuilderExecutor.build(model, parameters, new UnitToGraphicsDeviceParamsBuilder());
parameters.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
setVmRngDeviceToParams(model, parameters);
parameters.setBalloonEnabled(balloonEnabled(model));
parameters.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
if (model.getIsHeadlessModeEnabled().getEntity()) {
parameters.getVmTemplateData().setDefaultDisplayType(DisplayType.none);
}
Frontend.getInstance().runAction(ActionType.UpdateVmTemplate, parameters, result -> {
TemplateListModel localModel = (TemplateListModel) result.getState();
localModel.postUpdateVmTemplate(result.getReturnValue());
}, this);
}
Aggregations