Search in sources :

Example 6 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class BackendOpenStackImageProviderResource method remove.

@Override
public Response remove() {
    Provider provider = BackendExternalProviderHelper.getProvider(this, id);
    ProviderParameters parameters = new ProviderParameters(provider);
    return performAction(ActionType.RemoveProvider, parameters);
}
Also used : ProviderParameters(org.ovirt.engine.core.common.action.ProviderParameters) OpenStackImageProvider(org.ovirt.engine.api.model.OpenStackImageProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 7 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class BackendExternalComputeResourceResource method get.

@Override
public ExternalComputeResource get() {
    // Convert the resource identifier to the host group name:
    String name = hex2string(id);
    // The backend query that retrieves the list of hosts groups needs a complete provider instance, the id isn't
    // enough:
    Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
    // The backend doesn't have a way to retrieve a host by ide, so we have to iterate them:
    ProviderQueryParameters parameters = new ProviderQueryParameters();
    parameters.setProvider(provider);
    QueryReturnValue result = runQuery(QueryType.GetComputeResourceFromExternalProvider, parameters);
    List<org.ovirt.engine.core.common.businessentities.ExternalComputeResource> entities = result.getReturnValue();
    if (entities != null) {
        for (org.ovirt.engine.core.common.businessentities.ExternalComputeResource entity : entities) {
            if (name.equals(entity.getName())) {
                return addLinks(populate(map(entity), entity));
            }
        }
    }
    // No luck:
    return notFound();
}
Also used : ExternalComputeResource(org.ovirt.engine.api.model.ExternalComputeResource) 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)

Example 8 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class BackendExternalComputeResourcesResource method list.

@Override
public ExternalComputeResources list() {
    Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
    ProviderQueryParameters parameters = new ProviderQueryParameters();
    parameters.setProvider(provider);
    return mapCollection(getBackendCollection(QueryType.GetComputeResourceFromExternalProvider, parameters));
}
Also used : ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 9 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class BackendExternalDiscoveredHostsResource method list.

@Override
public ExternalDiscoveredHosts list() {
    Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
    ProviderQueryParameters parameters = new ProviderQueryParameters();
    parameters.setProvider(provider);
    return mapCollection(getBackendCollection(QueryType.GetDiscoveredHostListFromExternalProvider, parameters));
}
Also used : ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 10 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class BackendExternalHostGroupResource method get.

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

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