Search in sources :

Example 11 with ProviderQueryParameters

use of org.ovirt.engine.core.common.queries.ProviderQueryParameters in project ovirt-engine by oVirt.

the class AsyncDataProvider method getExternalProviderComputeResourceList.

public void getExternalProviderComputeResourceList(AsyncQuery<List<ExternalComputeResource>> aQuery, Provider provider) {
    aQuery.converterCallback = new ListConverter<>();
    ProviderQueryParameters params = new ProviderQueryParameters();
    params.setProvider(provider);
    Frontend.getInstance().runQuery(QueryType.GetComputeResourceFromExternalProvider, params, aQuery);
}
Also used : ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) GetVmsFromExternalProviderQueryParameters(org.ovirt.engine.core.common.queries.GetVmsFromExternalProviderQueryParameters)

Example 12 with ProviderQueryParameters

use of org.ovirt.engine.core.common.queries.ProviderQueryParameters in project ovirt-engine by oVirt.

the class BackendExternalDiscoveredHostResource method get.

@Override
public ExternalDiscoveredHost get() {
    // Convert the resource identifier to the host group name:
    String name = hex2string(id);
    // The backend doesn't have a way to retrieve a host by ide, so we have to iterate them:
    Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
    ProviderQueryParameters parameters = new ProviderQueryParameters();
    parameters.setProvider(provider);
    QueryReturnValue result = runQuery(QueryType.GetDiscoveredHostListFromExternalProvider, parameters);
    List<org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost> entities = result.getReturnValue();
    if (entities != null) {
        for (org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost entity : entities) {
            if (name.equals(entity.getName())) {
                return addLinks(populate(map(entity), entity));
            }
        }
    }
    // No luck:
    return notFound();
}
Also used : ExternalDiscoveredHost(org.ovirt.engine.api.model.ExternalDiscoveredHost) ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue)

Aggregations

ProviderQueryParameters (org.ovirt.engine.core.common.queries.ProviderQueryParameters)12 Provider (org.ovirt.engine.core.common.businessentities.Provider)8 ExternalHostProvider (org.ovirt.engine.api.model.ExternalHostProvider)6 GetVmsFromExternalProviderQueryParameters (org.ovirt.engine.core.common.queries.GetVmsFromExternalProviderQueryParameters)4 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 Certificate (org.ovirt.engine.api.model.Certificate)1 ExternalComputeResource (org.ovirt.engine.api.model.ExternalComputeResource)1 ExternalDiscoveredHost (org.ovirt.engine.api.model.ExternalDiscoveredHost)1 ExternalHostGroup (org.ovirt.engine.api.model.ExternalHostGroup)1 CertificateInfo (org.ovirt.engine.core.common.businessentities.CertificateInfo)1