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