use of org.ovirt.engine.core.common.action.ImportVmFromOvaParameters in project ovirt-engine by oVirt.
the class ImportVmFromOvaModel method buildImportVmFromOvaParameters.
private List<ActionParametersBase> buildImportVmFromOvaParameters() {
ImportVmData importVmData = (ImportVmData) getItems().iterator().next();
VM vm = importVmData.getVm();
ImportVmFromOvaParameters prm = new ImportVmFromOvaParameters(vm, getStorage().getSelectedItem().getId(), getStoragePool().getId(), getCluster().getSelectedItem().getId());
prm.setOvaPath(ovaPath);
prm.setProxyHostId(hostId);
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());
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);
}
return Collections.singletonList(prm);
}
Aggregations