use of org.ovirt.engine.core.common.action.ImportVmTemplateFromConfParameters in project ovirt-engine by oVirt.
the class BackendStorageDomainTemplateResource method register.
@Override
public Response register(Action action) {
ImportVmTemplateFromConfParameters params = new ImportVmTemplateFromConfParameters();
if (BackendVnicProfileHelper.foundOnlyDeprecatedVnicProfileMapping(action)) {
// This code block is for backward compatibility with {@link VnicProfileMapping}s that are specified
// outside the registration_configuration code, which is deprecated since 4.2.1 . When these mappings
// are removed from the ovirt-engine-api-model, this whole code block can be removed as well.
// In the meantime, if there are {@link VnicProfileMapping}s outside the registration_configuration
// block and no {@link RegistrationVnicProfileMapping}s inside it, they will be processed and used.
BackendVnicProfileHelper.validateVnicMappings(this, action);
Collection<ExternalVnicProfileMapping> vnicProfileMappings = ExternalVnicProfileMappingMapper.mapFromModel(action.getVnicProfileMappings());
params.setExternalVnicProfileMappings(vnicProfileMappings);
}
ExternalRegistrationConfigurationMapper.mapFromModel(action.getRegistrationConfiguration(), params);
params.setContainerId(guid);
params.setStorageDomainId(parent.getStorageDomainId());
if (action.isSetCluster()) {
params.setClusterId(getClusterId(action));
}
params.setImagesExistOnTargetStorageDomain(true);
if (action.isSetClone()) {
params.setImportAsNewEntity(action.isClone());
if (action.isSetVm() && action.getTemplate().isSetName()) {
params.getVmTemplate().setName(action.getTemplate().getName());
}
}
if (action.isSetAllowPartialImport()) {
params.setAllowPartialImport(action.isAllowPartialImport());
}
return doAction(ActionType.ImportVmTemplateFromConfiguration, params, action);
}
use of org.ovirt.engine.core.common.action.ImportVmTemplateFromConfParameters in project ovirt-engine by oVirt.
the class RegisterTemplateModel method prepareActionParameters.
private List<ActionParametersBase> prepareActionParameters() {
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (ImportTemplateData entityData : getEntities().getItems()) {
VmTemplate vmTemplate = entityData.getEntity();
Cluster cluster = entityData.getCluster().getSelectedItem();
ImportVmTemplateFromConfParameters params = new ImportVmTemplateFromConfParameters();
params.setExternalVnicProfileMappings(cloneExternalVnicProfiles(cluster));
params.setContainerId(vmTemplate.getId());
params.setStorageDomainId(getStorageDomainId());
params.setImagesExistOnTargetStorageDomain(true);
params.setClusterId(cluster != null ? cluster.getId() : null);
if (isQuotaEnabled()) {
Quota quota = entityData.getClusterQuota().getSelectedItem();
params.setQuotaId(quota != null ? quota.getId() : null);
params.setDiskTemplateMap(vmTemplate.getDiskTemplateMap());
updateDiskQuotas(new ArrayList<Disk>(params.getDiskTemplateMap().values()));
}
parameters.add(params);
}
return parameters;
}
Aggregations