Search in sources :

Example 1 with UpgradeStoragePoolVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.UpgradeStoragePoolVDSCommandParameters 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)

Aggregations

StorageFormatType (org.ovirt.engine.core.common.businessentities.StorageFormatType)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 UpgradeStoragePoolVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.UpgradeStoragePoolVDSCommandParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1 Version (org.ovirt.engine.core.compat.Version)1