use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class BackendExternalHostGroupResourceTest method getProvider.
private Provider getProvider() {
Provider provider = mock(Provider.class);
when(provider.getId()).thenReturn(GUIDS[0]);
when(provider.getName()).thenReturn(NAMES[0]);
return provider;
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class BackendExternalHostProviderResourceTest method getEntity.
@Override
protected Provider getEntity(int index) {
Provider provider = mock(Provider.class);
when(provider.getId()).thenReturn(GUIDS[index]);
when(provider.getName()).thenReturn(NAMES[index]);
when(provider.getDescription()).thenReturn(DESCRIPTIONS[index]);
return provider;
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class BackendClusterExternalNetworkProvidersResource method getBackendCollection.
private List<Provider> getBackendCollection() {
List<Provider> providers = new ArrayList<>();
Cluster cluster = getEntity(Cluster.class, QueryType.GetClusterById, new IdQueryParameters(clusterId), clusterId.toString(), true);
Guid defaultNetworkProviderId = cluster.getDefaultNetworkProviderId();
if (cluster.isSetDefaultNetworkProviderId()) {
providers.add(getEntity(Provider.class, QueryType.GetProviderById, new IdQueryParameters(defaultNetworkProviderId), defaultNetworkProviderId.toString()));
}
return providers;
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class AsyncDataProvider method getAllProvidersByProvidedEntity.
public void getAllProvidersByProvidedEntity(AsyncQuery<List<Provider<?>>> query, final VdcObjectType providedEntity) {
query.converterCallback = returnValue -> {
if (returnValue == null) {
return new ArrayList<>();
}
return ((Collection<Provider<?>>) returnValue).stream().filter(p -> p.getType().getProvidedTypes().contains(providedEntity)).sorted(new NameableComparator()).collect(Collectors.toList());
};
Frontend.getInstance().runQuery(QueryType.GetAllProviders, new GetAllProvidersParameters(), query);
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class IsoDomainListSynchronizer method refreshImageDomain.
private boolean refreshImageDomain(final StorageDomain storageDomain, final ImageFileType imageType) {
Provider provider = providerDao.get(new Guid(storageDomain.getStorage()));
final OpenStackImageProviderProxy client = providerProxyFactory.create(provider);
Lock syncObject = getSyncObject(storageDomain.getId(), imageType);
try {
syncObject.lock();
return TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, () -> {
repoFileMetaDataDao.removeRepoDomainFileList(storageDomain.getId(), imageType);
Integer totalListSize = Config.<Integer>getValue(ConfigValues.GlanceImageTotalListSize);
List<RepoImage> repoImages = client.getAllImagesAsRepoImages(Config.<Integer>getValue(ConfigValues.GlanceImageListSize), totalListSize);
if (repoImages.size() >= totalListSize) {
AuditLogable logable = new AuditLogableImpl();
logable.addCustomValue("imageDomain", storageDomain.getName()).addCustomValue("imageListSize", String.valueOf(repoImages.size()));
logable.setStorageDomainId(storageDomain.getId());
logable.setStorageDomainName(storageDomain.getName());
auditLogDirector.log(logable, AuditLogType.REFRESH_REPOSITORY_IMAGE_LIST_INCOMPLETE);
}
for (RepoImage repoImage : repoImages) {
repoImage.setRepoDomainId(storageDomain.getId());
repoFileMetaDataDao.addRepoFileMap(repoImage);
}
return true;
});
} finally {
syncObject.unlock();
}
}
Aggregations