Search in sources :

Example 41 with Provider

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;
}
Also used : Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 42 with 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;
}
Also used : ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 43 with 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;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid) ExternalProvider(org.ovirt.engine.api.model.ExternalProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 44 with Provider

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);
}
Also used : ArrayList(java.util.ArrayList) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) GetAllProvidersParameters(org.ovirt.engine.core.common.queries.GetAllProvidersParameters) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 45 with Provider

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();
    }
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) Guid(org.ovirt.engine.core.compat.Guid) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl) OpenStackImageProviderProxy(org.ovirt.engine.core.bll.provider.storage.OpenStackImageProviderProxy) Provider(org.ovirt.engine.core.common.businessentities.Provider) ReentrantLock(java.util.concurrent.locks.ReentrantLock) Lock(java.util.concurrent.locks.Lock)

Aggregations

Provider (org.ovirt.engine.core.common.businessentities.Provider)63 ExternalHostProvider (org.ovirt.engine.api.model.ExternalHostProvider)10 ArrayList (java.util.ArrayList)7 ProviderQueryParameters (org.ovirt.engine.core.common.queries.ProviderQueryParameters)7 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)7 ProviderParameters (org.ovirt.engine.core.common.action.ProviderParameters)6 Test (org.junit.Test)5 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)5 Guid (org.ovirt.engine.core.compat.Guid)5 List (java.util.List)4 OpenStackNetworkProvider (org.ovirt.engine.api.model.OpenStackNetworkProvider)4 OpenStackVolumeProvider (org.ovirt.engine.api.model.OpenStackVolumeProvider)4 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 ExternalDiscoveredHost (org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost)4 ExternalHostGroup (org.ovirt.engine.core.common.businessentities.ExternalHostGroup)4 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)4 ExternalProvider (org.ovirt.engine.api.model.ExternalProvider)3 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)3 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)3