use of org.ovirt.engine.core.common.action.ImportVmFromExternalProviderParameters in project ovirt-engine by oVirt.
the class ImportVmFromExternalSourceModel method buildImportVmFromExternalProviderParameters.
private List<ActionParametersBase> buildImportVmFromExternalProviderParameters() {
List<ActionParametersBase> prms = new ArrayList<>();
for (Object item : getItems()) {
ImportVmData importVmData = (ImportVmData) item;
VM vm = importVmData.getVm();
ImportVmFromExternalProviderParameters prm = new ImportVmFromExternalProviderParameters(vm, getStorage().getSelectedItem().getId(), getStoragePool().getId(), getCluster().getSelectedItem().getId());
prm.setUrl(url);
prm.setUsername(username);
prm.setPassword(password);
prm.setProxyHostId(proxyHostId);
prm.setVirtioIsoName(getIso().getIsChangable() && getIso().getSelectedItem() != null ? getIso().getSelectedItem().getRepoImageId() : null);
prm.setExternalName(importVmData.getName());
if (getClusterQuota().getSelectedItem() != null && getClusterQuota().getIsAvailable()) {
prm.setQuotaId(getClusterQuota().getSelectedItem().getId());
}
CpuProfile cpuProfile = getCpuProfiles().getSelectedItem();
if (cpuProfile != null) {
prm.setCpuProfileId(cpuProfile.getId());
}
prm.setForceOverride(true);
prm.setCopyCollapse(importVmData.getCollapseSnapshots().getEntity());
for (Map.Entry<Guid, Disk> entry : vm.getDiskMap().entrySet()) {
DiskImage disk = (DiskImage) entry.getValue();
ImportDiskData importDiskData = getDiskImportData(disk.getDiskAlias());
disk.setVolumeType(getAllocation().getSelectedItem());
// virt-v2v which converts the image format as well
if (vm.getOrigin() != OriginType.KVM) {
disk.setVolumeFormat(AsyncDataProvider.getInstance().getDiskVolumeFormat(disk.getVolumeType(), getStorage().getSelectedItem().getStorageType()));
}
if (getDiskImportData(disk.getDiskAlias()).getSelectedQuota() != null) {
disk.setQuotaId(importDiskData.getSelectedQuota().getId());
}
}
updateNetworkInterfacesForVm(vm);
if (importVmData.isExistsInSystem() || importVmData.getClone().getEntity()) {
prm.setImportAsNewEntity(true);
prm.setCopyCollapse(true);
}
prms.add(prm);
}
return prms;
}
Aggregations