use of org.ovirt.engine.core.common.action.ImportVmFromExternalUrlParameters in project ovirt-engine by oVirt.
the class BackendExternalVmImportsResource method add.
@Override
public Response add(ExternalVmImport externalVmImport) {
validateParameters(externalVmImport, "provider", "url", "name", "sparse", "cluster.id|name", "storageDomain.id|name");
ImportVmFromExternalUrlParameters parameters = buildImportParameters(externalVmImport);
VM createdVm = performAction(ActionType.ImportVmFromExternalUrl, parameters, VM.class);
// Postprocess output entity to clear sensitive data and resolve links.
externalVmImport.setPassword(null);
externalVmImport.setVm(withIdLink(new Vm(), createdVm.getId()));
externalVmImport.setCluster(withIdLink(new org.ovirt.engine.api.model.Cluster(), parameters.getClusterId()));
externalVmImport.setStorageDomain(withIdLink(new StorageDomain(), parameters.getStorageDomainId()));
if (externalVmImport.isSetHost()) {
externalVmImport.setHost(withIdLink(new Host(), parameters.getProxyHostId()));
}
return Response.ok(externalVmImport).status(Response.Status.CREATED).build();
}
use of org.ovirt.engine.core.common.action.ImportVmFromExternalUrlParameters in project ovirt-engine by oVirt.
the class BackendExternalVmImportsResource method buildImportParameters.
private ImportVmFromExternalUrlParameters buildImportParameters(ExternalVmImport vmImport) {
ImportVmFromExternalUrlParameters parameters = new ImportVmFromExternalUrlParameters();
parameters.setUrl(vmImport.getUrl());
parameters.setOriginType(getOriginType(vmImport));
parameters.setExternalName(vmImport.getName());
parameters.setNewVmName(vmImport.getVm() != null ? vmImport.getVm().getName() : null);
parameters.setVolumeType(getVolumeType(vmImport));
parameters.setProxyHostId(getProxyHostId(vmImport));
parameters.setVirtioIsoName(getVirtioIsoName(vmImport));
parameters.setStorageDomainId(getStorageDomainId(vmImport));
parameters.setClusterId(getClusterId(vmImport));
parameters.setQuotaId(getQuotaId(vmImport));
parameters.setCpuProfileId(getCpuProfileId(vmImport));
parameters.setUsername(vmImport.getUsername());
parameters.setPassword(vmImport.getPassword());
return parameters;
}
Aggregations