Search in sources :

Example 36 with StoragePool

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

the class BackendNetworksResourceTest method setUpStoragePool.

protected StoragePool setUpStoragePool(Guid id) {
    StoragePool pool = mock(StoragePool.class);
    when(pool.getId()).thenReturn(id);
    return pool;
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 37 with StoragePool

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

the class VdsBrokerObjectsBuilder method buildStoragePool.

public static StoragePool buildStoragePool(Map<String, Object> struct) {
    StoragePool sPool = new StoragePool();
    if (struct.containsKey("type")) {
        sPool.setIsLocal(StorageType.valueOf(struct.get("type").toString()).isLocal());
    }
    sPool.setName(assignStringValue(struct, "name"));
    Integer masterVersion = assignIntValue(struct, "master_ver");
    if (masterVersion != null) {
        sPool.setMasterDomainVersion(masterVersion);
    }
    return sPool;
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 38 with StoragePool

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

the class Cloner method cloneStoragePool.

private static StoragePool cloneStoragePool(StoragePool instance) {
    StoragePool obj = new StoragePool();
    obj.setdescription(instance.getdescription());
    obj.setComment(instance.getComment());
    obj.setId(instance.getId());
    obj.setName(instance.getName());
    obj.setIsLocal(instance.isLocal());
    obj.setStatus(instance.getStatus());
    obj.setMasterDomainVersion(instance.getMasterDomainVersion());
    obj.setLVER(instance.getLVER());
    obj.setRecoveryMode(instance.getRecoveryMode());
    obj.setSpmVdsId(instance.getSpmVdsId());
    obj.setStoragePoolCompatibilityLevelUpgradeNeeded(instance.isStoragePoolCompatibilityLevelUpgradeNeeded());
    obj.setCompatibilityVersion(instance.getCompatibilityVersion());
    return obj;
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 39 with StoragePool

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

the class BaseImportNetworksModel method onProviderChosen.

private void onProviderChosen() {
    final Provider<?> provider = providers.getSelectedItem();
    if (provider == null) {
        return;
    }
    startProgress();
    AsyncQuery<List<StoragePool>> dataCenterQuery = new AsyncQuery<>(returnValue -> {
        final List<StoragePool> dataCenters = new LinkedList<>(returnValue);
        Collections.sort(dataCenters, new NameableComparator());
        AsyncQuery<QueryReturnValue> externalNetworksQuery = new AsyncQuery<>(queryReturnValue -> {
            if (queryReturnValue.getSucceeded()) {
                Map<Network, Set<Guid>> externalNetworkToDataCenters = queryReturnValue.getReturnValue();
                providerNetworks.setItems(getExternalNetworks(externalNetworkToDataCenters, dataCenters));
                importedNetworks.setItems(new LinkedList<ExternalNetwork>());
            } else {
                final ErrorPopupManager popupManager = (ErrorPopupManager) TypeResolver.getInstance().resolve(ErrorPopupManager.class);
                popupManager.show(ConstantsManager.getInstance().getMessages().failedToListExternalNetworks(queryReturnValue.getExceptionMessage()));
            }
            stopProgress();
        }, true);
        AsyncDataProvider.getInstance().getExternalNetworksByProviderId(externalNetworksQuery, provider.getId());
    });
    AsyncDataProvider.getInstance().getDataCenterList(dataCenterQuery);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Set(java.util.Set) NameableComparator(org.ovirt.engine.core.common.businessentities.comparators.NameableComparator) LinkedList(java.util.LinkedList) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Network(org.ovirt.engine.core.common.businessentities.network.Network) ExternalNetwork(org.ovirt.engine.ui.uicommonweb.models.providers.ExternalNetwork) ErrorPopupManager(org.ovirt.engine.ui.uicommonweb.ErrorPopupManager) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ExternalNetwork(org.ovirt.engine.ui.uicommonweb.models.providers.ExternalNetwork)

Example 40 with StoragePool

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

the class BaseImportNetworksModel method getExternalNetwork.

private ExternalNetwork getExternalNetwork(Network network, Set<Guid> attachedDataCenters, List<StoragePool> dataCenters) {
    ExternalNetwork externalNetwork = new ExternalNetwork();
    externalNetwork.setNetwork(network);
    externalNetwork.setDisplayName(network.getName());
    externalNetwork.setPublicUse(true);
    List<StoragePool> availableDataCenters = getAvailableDataCenters(dataCenters, attachedDataCenters);
    externalNetwork.getDataCenters().setItems(availableDataCenters);
    externalNetwork.getDataCenters().setSelectedItem(dataCenterListModel.getSelectedItem() != null && availableDataCenters.contains(dataCenterListModel.getSelectedItem()) ? dataCenterListModel.getSelectedItem() : Linq.firstOrNull(availableDataCenters));
    return externalNetwork;
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ExternalNetwork(org.ovirt.engine.ui.uicommonweb.models.providers.ExternalNetwork)

Aggregations

StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)239 Guid (org.ovirt.engine.core.compat.Guid)83 ArrayList (java.util.ArrayList)78 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)60 Test (org.junit.Test)59 List (java.util.List)46 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)35 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)34 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)31 QueryType (org.ovirt.engine.core.common.queries.QueryType)31 Frontend (org.ovirt.engine.ui.frontend.Frontend)31 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)28 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)28 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)27 Linq (org.ovirt.engine.ui.uicommonweb.Linq)26 Arrays (java.util.Arrays)25 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)25