use of org.ovirt.engine.core.compat.KeyValuePairCompat in project ovirt-engine by oVirt.
the class ProcessOvfUpdateForStoragePoolCommand method populateTemplatesMetadataForOvfUpdate.
/**
* Creates and returns a map containing valid templates metadata
*/
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateTemplatesMetadataForOvfUpdate(List<Guid> idsToProcess) {
Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<>();
List<VmTemplate> templates = vmTemplateDao.getVmTemplatesByIds(idsToProcess);
for (VmTemplate template : templates) {
if (VmTemplateStatus.Locked != template.getStatus()) {
updateTemplateDisksFromDb(template);
boolean verifyDisksNotLocked = verifyImagesStatus(template.getDiskList());
if (verifyDisksNotLocked) {
ovfUpdateProcessHelper.loadTemplateData(template);
Long currentDbGeneration = vmStaticDao.getDbGeneration(template.getId());
// currentDbGeneration can be null in case that the template was deleted during the run of OvfDataUpdater.
if (currentDbGeneration != null && template.getDbGeneration() == currentDbGeneration) {
proccessedOvfConfigurationsInfo.add(ovfUpdateProcessHelper.buildMetadataDictionaryForTemplate(template, vmsAndTemplateMetadata));
proccessedIdsInfo.add(template.getId());
proccessedOvfGenerationsInfo.add(template.getDbGeneration());
proccessDisksDomains(template.getDiskList());
}
}
}
}
return vmsAndTemplateMetadata;
}
use of org.ovirt.engine.core.compat.KeyValuePairCompat in project ovirt-engine by oVirt.
the class ExportVmCommand method updateVmInSpm.
protected void updateVmInSpm() {
Map<Guid, KeyValuePairCompat<String, List<Guid>>> metaDictionary = new HashMap<>();
ovfUpdateProcessHelper.loadVmData(getVm());
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(getVm());
fullEntityOvfData.setClusterName(getVm().getClusterName());
fullEntityOvfData.setDiskImages(ovfUpdateProcessHelper.getVmImagesFromDb(getVm()));
ovfUpdateProcessHelper.buildMetadataDictionaryForVm(getVm(), metaDictionary, fullEntityOvfData);
ovfUpdateProcessHelper.executeUpdateVmInSpmCommand(getVm().getStoragePoolId(), metaDictionary, getParameters().getStorageDomainId());
}
Aggregations