Search in sources :

Example 1 with GetHostListFromExternalProviderParameters

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

the class BackendExternalHostsResource method list.

@Override
public ExternalHosts list() {
    GetHostListFromExternalProviderParameters parameters = new GetHostListFromExternalProviderParameters();
    parameters.setFilterOutExistingHosts(true);
    parameters.setProviderId(asGuid(providerId));
    return mapCollection(getBackendCollection(QueryType.GetHostListFromExternalProvider, parameters));
}
Also used : GetHostListFromExternalProviderParameters(org.ovirt.engine.core.common.queries.GetHostListFromExternalProviderParameters)

Example 2 with GetHostListFromExternalProviderParameters

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

the class AsyncDataProvider method getExternalProviderHostList.

public void getExternalProviderHostList(AsyncQuery<List<VDS>> aQuery, Guid providerId, boolean filterOutExistingHosts, String searchFilter) {
    aQuery.converterCallback = new ListConverter<>();
    GetHostListFromExternalProviderParameters params = new GetHostListFromExternalProviderParameters();
    params.setFilterOutExistingHosts(filterOutExistingHosts);
    params.setProviderId(providerId);
    params.setSearchFilter(searchFilter);
    Frontend.getInstance().runQuery(QueryType.GetHostListFromExternalProvider, params, aQuery);
}
Also used : GetHostListFromExternalProviderParameters(org.ovirt.engine.core.common.queries.GetHostListFromExternalProviderParameters)

Example 3 with GetHostListFromExternalProviderParameters

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

the class BackendExternalHostResource method get.

@Override
public ExternalHost 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:
    GetHostListFromExternalProviderParameters parameters = new GetHostListFromExternalProviderParameters();
    parameters.setFilterOutExistingHosts(true);
    parameters.setProviderId(asGuid(providerId));
    QueryReturnValue result = runQuery(QueryType.GetHostListFromExternalProvider, parameters);
    List<VDS> entities = result.getReturnValue();
    if (entities != null) {
        for (VDS entity : entities) {
            if (name.equals(entity.getName())) {
                return addLinks(populate(map(entity), entity));
            }
        }
    }
    // No luck:
    return notFound();
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GetHostListFromExternalProviderParameters(org.ovirt.engine.core.common.queries.GetHostListFromExternalProviderParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS)

Aggregations

GetHostListFromExternalProviderParameters (org.ovirt.engine.core.common.queries.GetHostListFromExternalProviderParameters)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1