Search in sources :

Example 81 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class ClusterPopupPresenterWidget method computeCustomMigrationBandwidthLimitEnabledState.

/**
 * @return true ~ enable, false ~ disable, null ~ can't be computed
 */
private Optional<Boolean> computeCustomMigrationBandwidthLimitEnabledState(ClusterModel clusterModel) {
    final Version clusterVersion = clusterModel.getVersion().getSelectedItem();
    final MigrationBandwidthLimitType limitType = clusterModel.getMigrationBandwidthLimitType().getSelectedItem();
    if (clusterVersion == null || limitType == null) {
        return Optional.empty();
    }
    final Optional<Boolean> enabled = Optional.of(AsyncDataProvider.getInstance().isMigrationPoliciesSupported(clusterVersion) && limitType == MigrationBandwidthLimitType.CUSTOM);
    return enabled;
}
Also used : MigrationBandwidthLimitType(org.ovirt.engine.core.common.businessentities.MigrationBandwidthLimitType) Version(org.ovirt.engine.core.compat.Version)

Example 82 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class UpdateStoragePoolCommand method updateStoragePoolFormatType.

private void updateStoragePoolFormatType() {
    final StoragePool storagePool = getStoragePool();
    final Guid spId = storagePool.getId();
    final Version spVersion = storagePool.getCompatibilityVersion();
    final Version oldSpVersion = getOldStoragePool().getCompatibilityVersion();
    if (oldSpVersion.equals(spVersion)) {
        return;
    }
    StorageFormatType targetFormat = updatePoolAndDomainsFormat(spVersion);
    if (getOldStoragePool().getStatus() == StoragePoolStatus.Up) {
        try {
            // No need to worry about "reupgrading" as VDSM will silently ignore
            // the request.
            runVdsCommand(VDSCommandType.UpgradeStoragePool, new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat));
        } catch (EngineException e) {
            log.warn("Upgrade process of Storage Pool '{}' has encountered a problem due to following reason: {}", spId, e.getMessage());
            auditLogDirector.log(this, AuditLogType.UPGRADE_STORAGE_POOL_ENCOUNTERED_PROBLEMS);
            // and return.
            if (e.getVdsError() != null && e.getErrorCode() == EngineError.PoolUpgradeInProgress) {
                updatePoolAndDomainsFormat(oldSpVersion);
                return;
            }
        }
    }
    runSynchronizeOperation(new RefreshPoolSingleAsyncOperationFactory(), new ArrayList<Guid>());
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Version(org.ovirt.engine.core.compat.Version) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) EngineException(org.ovirt.engine.core.common.errors.EngineException) Guid(org.ovirt.engine.core.compat.Guid) UpgradeStoragePoolVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.UpgradeStoragePoolVDSCommandParameters)

Example 83 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class ExistingVmModelBehavior method isRestoreMemoryVolumeSupported.

private boolean isRestoreMemoryVolumeSupported() {
    // before edit
    Version oldVmEffectiveVersion = getVm().getCompatibilityVersion();
    Version newVmCustomCompatibilityVersion = getModel().getCustomCompatibilityVersion() == null ? null : getModel().getCustomCompatibilityVersion().getSelectedItem();
    Version newClusterVersion = getModel().getSelectedCluster() == null ? null : getModel().getSelectedCluster().getCompatibilityVersion();
    Version newVmEffectiveVersion = CommonCompatibilityVersionUtils.getEffective(newVmCustomCompatibilityVersion, newClusterVersion, Version.getLast());
    return oldVmEffectiveVersion.equals(newVmEffectiveVersion);
}
Also used : Version(org.ovirt.engine.core.compat.Version)

Example 84 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class NetworkFilterDaoTest method testGetAllSupportedNetworkFiltersByVersionMediumVersion.

@Test
public void testGetAllSupportedNetworkFiltersByVersionMediumVersion() {
    final Version version = new Version("3.5");
    assertFirstVersionOnly(version);
}
Also used : Version(org.ovirt.engine.core.compat.Version) Test(org.junit.Test)

Example 85 with Version

use of org.ovirt.engine.core.compat.Version in project ovirt-engine by oVirt.

the class NetworkFilterDaoTest method testGetAllSupportedNetworkFiltersByInvalidVersion.

@Test
public void testGetAllSupportedNetworkFiltersByInvalidVersion() {
    final Version version = new Version(INVALID_VERSION);
    final List<NetworkFilter> allNetworkFilter = dao.getAllSupportedNetworkFiltersByVersion(version);
    assertTrue(allNetworkFilter.isEmpty());
}
Also used : Version(org.ovirt.engine.core.compat.Version) NetworkFilter(org.ovirt.engine.core.common.businessentities.network.NetworkFilter) Test(org.junit.Test)

Aggregations

Version (org.ovirt.engine.core.compat.Version)102 ArrayList (java.util.ArrayList)24 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)20 Guid (org.ovirt.engine.core.compat.Guid)20 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)17 Map (java.util.Map)16 List (java.util.List)15 HashSet (java.util.HashSet)14 VDS (org.ovirt.engine.core.common.businessentities.VDS)14 HashMap (java.util.HashMap)13 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)12 VM (org.ovirt.engine.core.common.businessentities.VM)11 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)11 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)11 Arrays (java.util.Arrays)10 MigrationPolicy (org.ovirt.engine.core.common.migration.MigrationPolicy)10 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)10 Collection (java.util.Collection)9 Collections (java.util.Collections)9 ArchitectureType (org.ovirt.engine.core.common.businessentities.ArchitectureType)9