Search in sources :

Example 1 with AddVmPoolParameters

use of org.ovirt.engine.core.common.action.AddVmPoolParameters in project ovirt-engine by oVirt.

the class UpdateVmPoolCommandTest method createCommand.

@Override
protected UpdateVmPoolCommand<AddVmPoolParameters> createCommand() {
    AddVmPoolParameters param = new AddVmPoolParameters(vmPools, testVm, VM_COUNT);
    param.setStorageDomainId(firstStorageDomainId);
    return new UpdateVmPoolCommand<>(param, null);
}
Also used : AddVmPoolParameters(org.ovirt.engine.core.common.action.AddVmPoolParameters)

Example 2 with AddVmPoolParameters

use of org.ovirt.engine.core.common.action.AddVmPoolParameters in project ovirt-engine by oVirt.

the class PoolListModel method savePoolPostValidation.

public void savePoolPostValidation() {
    final PoolModel model = (PoolModel) getWindow();
    VmPool pool = getCurrentPool();
    setConfirmWindow(null);
    // Save changes.
    pool.setName(model.getName().getEntity());
    pool.setVmPoolDescription(model.getDescription().getEntity());
    pool.setClusterId(model.getSelectedCluster().getId());
    pool.setComment(model.getComment().getEntity());
    pool.setStateful(model.getPoolStateful().getEntity());
    pool.setPrestartedVms(model.getPrestartedVms().getEntity());
    pool.setMaxAssignedVmsPerUser(model.getMaxAssignedVmsPerUser().getEntity());
    pool.setAutoStorageSelect(model.getDisksAllocationModel().getDiskAllocationTargetEnabled().getEntity());
    EntityModel<VmPoolType> poolTypeSelectedItem = model.getPoolType().getSelectedItem();
    pool.setVmPoolType(poolTypeSelectedItem.getEntity());
    if (model.getSpiceProxyEnabled().getEntity()) {
        pool.setSpiceProxy(model.getSpiceProxy().getEntity());
    }
    VM vm = buildVmOnSave(model);
    vm.setVmInit(model.getVmInitModel().buildCloudInitParameters(model));
    vm.setUseLatestVersion(model.getTemplateWithVersion().getSelectedItem().isLatest());
    vm.setStateless(false);
    vm.setInstanceTypeId(model.getInstanceTypes().getSelectedItem().getId());
    AddVmPoolParameters param = new AddVmPoolParameters(pool, vm, model.getNumOfDesktops().getEntity());
    param.setStorageDomainId(Guid.Empty);
    param.setDiskInfoDestinationMap(model.getDisksAllocationModel().getImageToDestinationDomainMap());
    param.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
    param.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
    param.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
    param.setRngDevice(model.getIsRngEnabled().getEntity() ? model.generateRngDevice() : null);
    param.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
    param.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
    if (model.getIsHeadlessModeEnabled().getEntity()) {
        param.getVmStaticData().setDefaultDisplayType(DisplayType.none);
    }
    BuilderExecutor.build(model, param, new UnitToGraphicsDeviceParamsBuilder());
    param.getVmStaticData().setUseHostCpuFlags(model.getHostCpu().getEntity());
    param.getVmStaticData().setCpuPinning(model.getCpuPinning().getEntity());
    if (model.getQuota().getSelectedItem() != null) {
        vm.setQuotaId(model.getQuota().getSelectedItem().getId());
    }
    model.startProgress();
    if (model.getIsNew()) {
        if (model.getIcon().getEntity().isCustom()) {
            param.setVmLargeIcon(model.getIcon().getEntity().getIcon());
        }
        Frontend.getInstance().runAction(ActionType.AddVmPool, param, result -> {
            cancel();
            stopProgress();
        }, this);
    } else {
        Frontend.getInstance().runAction(ActionType.UpdateVmPool, param, result -> {
            cancel();
            stopProgress();
        }, this);
    }
}
Also used : UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) VM(org.ovirt.engine.core.common.businessentities.VM) VmPoolType(org.ovirt.engine.core.common.businessentities.VmPoolType) AddVmPoolParameters(org.ovirt.engine.core.common.action.AddVmPoolParameters)

Example 3 with AddVmPoolParameters

use of org.ovirt.engine.core.common.action.AddVmPoolParameters in project ovirt-engine by oVirt.

the class AddVmPoolCommandTest method createCommand.

@Override
protected AddVmPoolCommand<AddVmPoolParameters> createCommand() {
    AddVmPoolParameters param = new AddVmPoolParameters(vmPools, testVm, VM_COUNT);
    param.setStorageDomainId(firstStorageDomainId);
    return new AddVmPoolCommand<>(param, null);
}
Also used : AddVmPoolParameters(org.ovirt.engine.core.common.action.AddVmPoolParameters)

Example 4 with AddVmPoolParameters

use of org.ovirt.engine.core.common.action.AddVmPoolParameters in project ovirt-engine by oVirt.

the class BackendVmPoolsResource method add.

@Override
public Response add(VmPool pool) {
    validateParameters(pool, "name", "template.id|name", "cluster.id|name");
    Cluster cluster = getCluster(pool);
    pool.getCluster().setId(cluster.getId().toString());
    VmTemplate template = getVmTemplate(pool);
    if (namedTemplate(pool)) {
        pool.getTemplate().setId(template.getId().toString());
    }
    org.ovirt.engine.core.common.businessentities.VmPool entity = map(pool);
    VM vm = mapToVM(pool, template, cluster);
    int size = pool.isSetSize() ? pool.getSize() : 1;
    AddVmPoolParameters params = new AddVmPoolParameters(entity, vm, size);
    params.setConsoleEnabled(pool.isSetVm() && pool.getVm().isSetConsole() && pool.getVm().getConsole().isSetEnabled() ? pool.getVm().getConsole().isEnabled() : !getConsoleDevicesForEntity(template.getId()).isEmpty());
    params.setVirtioScsiEnabled(!VmHelper.getVirtioScsiControllersForEntity(this, template.getId()).isEmpty());
    params.setSoundDeviceEnabled(pool.isSetSoundcardEnabled() ? pool.isSoundcardEnabled() : !VmHelper.getSoundDevicesForEntity(this, template.getId()).isEmpty());
    params.setRngDevice(pool.isSetVm() && pool.getVm().isSetRngDevice() ? RngDeviceMapper.map(pool.getVm().getRngDevice(), null) : params.getRngDevice());
    boolean balloonEnabled = pool.isSetVm() && pool.getVm().isSetMemoryPolicy() && pool.getVm().getMemoryPolicy().isSetBallooning() && pool.getVm().getMemoryPolicy().isBallooning();
    params.setBalloonEnabled(balloonEnabled);
    params.getVmStaticData().setCustomProperties(pool.isSetVm() && pool.getVm().isSetCustomProperties() ? CustomPropertiesParser.parse(pool.getVm().getCustomProperties().getCustomProperties()) : params.getVmStaticData().getCustomProperties());
    return performCreate(ActionType.AddVmPool, params, new QueryIdResolver<Guid>(QueryType.GetVmPoolById, IdQueryParameters.class));
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid) AddVmPoolParameters(org.ovirt.engine.core.common.action.AddVmPoolParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) VM(org.ovirt.engine.core.common.businessentities.VM)

Aggregations

AddVmPoolParameters (org.ovirt.engine.core.common.action.AddVmPoolParameters)4 VM (org.ovirt.engine.core.common.businessentities.VM)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 VmPool (org.ovirt.engine.core.common.businessentities.VmPool)1 VmPoolType (org.ovirt.engine.core.common.businessentities.VmPoolType)1 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1 UnitToGraphicsDeviceParamsBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder)1