use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback in project ovirt-engine by oVirt.
the class InstanceTypeListModel method onEditInstanceType.
private void onEditInstanceType() {
UnitVmModel model = (UnitVmModel) getWindow();
if (!model.validateInstanceTypePart()) {
return;
}
VmTemplate instanceType = (VmTemplate) Cloner.clone(selectedItem);
instanceType.setTemplateType(VmEntityType.INSTANCE_TYPE);
buildVmStatic(instanceType);
instanceType.setDescription(model.getDescription().getEntity());
UpdateVmTemplateParameters updateInstanceTypeParameters = new UpdateVmTemplateParameters(instanceType);
updateInstanceTypeParameters.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
updateInstanceTypeParameters.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
updateInstanceTypeParameters.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
updateInstanceTypeParameters.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
if (model.getIsHeadlessModeEnabled().getEntity()) {
updateInstanceTypeParameters.getVmTemplateData().setDefaultDisplayType(DisplayType.none);
}
setVmWatchdogToParams(model, updateInstanceTypeParameters);
setRngDeviceToParams(model, updateInstanceTypeParameters);
BuilderExecutor.build(model, updateInstanceTypeParameters, new UnitToGraphicsDeviceParamsBuilder());
getWindow().startProgress();
Frontend.getInstance().runAction(ActionType.UpdateVmTemplate, updateInstanceTypeParameters, new UnitVmModelNetworkAsyncCallback(model, addInstanceTypeNetworkManager, instanceType.getId()), this);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback in project ovirt-engine by oVirt.
the class VmBaseListModel method createUnitVmModelNetworkAsyncCallback.
protected UnitVmModelNetworkAsyncCallback createUnitVmModelNetworkAsyncCallback(VM vm, UnitVmModel model) {
if (vm.getVmtGuid().equals(Guid.Empty)) {
return new UnitVmModelNetworkAsyncCallback(model, addVmFromBlankTemplateNetworkManager) {
@Override
public void executed(FrontendActionAsyncResult result) {
getWindow().stopProgress();
ActionReturnValue returnValue = result.getReturnValue();
if (returnValue != null && returnValue.getSucceeded()) {
setWindow(null);
updateActionsAvailability();
} else {
cancel();
}
super.executed(result);
}
};
}
return new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback 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);
}
Aggregations