use of org.ovirt.engine.core.common.action.AddVmParameters in project ovirt-engine by oVirt.
the class BackendVmsResource method addVmFromScratch.
protected Response addVmFromScratch(VmStatic staticVm, Vm vm, InstanceType instanceType, Cluster cluster) {
AddVmParameters params = new AddVmParameters(staticVm);
params.setVmPayload(getPayload(vm));
params.setMakeCreatorExplicitOwner(shouldMakeCreatorExplicitOwner());
addDevicesToParams(params, vm, null, instanceType, staticVm, cluster);
IconHelper.setIconToParams(vm, params);
DisplayHelper.setGraphicsToParams(vm.getDisplay(), params);
return performCreate(ActionType.AddVmFromScratch, params, new QueryIdResolver<Guid>(QueryType.GetVmByVmId, IdQueryParameters.class));
}
use of org.ovirt.engine.core.common.action.AddVmParameters in project ovirt-engine by oVirt.
the class CommonVmPoolCommand method buildAddVmParameters.
private AddVmParameters buildAddVmParameters(String vmName) {
VmStatic currVm = new VmStatic(getParameters().getVmStaticData());
currVm.setName(vmName);
currVm.setStateless(!getVmPool().isStateful());
if (getParameters().getVmLargeIcon() != null) {
final VmIconIdSizePair iconIds = iconUtils.ensureIconPairInDatabase(getParameters().getVmLargeIcon());
currVm.setSmallIconId(iconIds.getSmall());
currVm.setLargeIconId(iconIds.getLarge());
}
AddVmParameters parameters = new AddVmParameters(currVm);
parameters.setPoolId(getVmPool().getVmPoolId());
if (getVmPool().isAutoStorageSelect()) {
parameters.setDiskInfoDestinationMap(autoSelectTargetDomainAndVolumeFormat());
} else {
parameters.setDiskInfoDestinationMap(diskInfoDestinationMap);
}
if (StringUtils.isEmpty(getParameters().getSessionId())) {
parameters.setParametersCurrentUser(getCurrentUser());
} else {
parameters.setSessionId(getParameters().getSessionId());
}
parameters.setParentCommand(getActionType());
parameters.setParentParameters(getParameters());
// check if device is enabled or we need to override it to true
parameters.setSoundDeviceEnabled(Boolean.TRUE.equals(getParameters().isSoundDeviceEnabled()) || vmDeviceUtils.shouldOverrideSoundDevice(getParameters().getVmStaticData(), getEffectiveCompatibilityVersion(), getParameters().isSoundDeviceEnabled()));
parameters.setConsoleEnabled(getParameters().isConsoleEnabled());
parameters.setVirtioScsiEnabled(getParameters().isVirtioScsiEnabled());
parameters.setBalloonEnabled(getParameters().isBalloonEnabled());
parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED);
VmRngDevice rngDevice = getParameters().getRngDevice();
if (rngDevice != null) {
parameters.setUpdateRngDevice(true);
parameters.setRngDevice(rngDevice);
}
parameters.getGraphicsDevices().putAll(getParameters().getGraphicsDevices());
return parameters;
}
Aggregations