Search in sources :

Example 1 with UnitVmModelNetworkAsyncCallback

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);
}
Also used : UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) UpdateVmTemplateParameters(org.ovirt.engine.core.common.action.UpdateVmTemplateParameters) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Example 2 with UnitVmModelNetworkAsyncCallback

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);
}
Also used : UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) FrontendActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 3 with UnitVmModelNetworkAsyncCallback

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);
}
Also used : UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) VM(org.ovirt.engine.core.common.businessentities.VM) AddVmTemplateParameters(org.ovirt.engine.core.common.action.AddVmTemplateParameters) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Aggregations

UnitVmModelNetworkAsyncCallback (org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback)3 UnitToGraphicsDeviceParamsBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder)2 UnitVmModel (org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 AddVmTemplateParameters (org.ovirt.engine.core.common.action.AddVmTemplateParameters)1 UpdateVmTemplateParameters (org.ovirt.engine.core.common.action.UpdateVmTemplateParameters)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)1 FrontendActionAsyncResult (org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult)1