Search in sources :

Example 1 with SpmStartVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.SpmStartVDSCommandParameters in project ovirt-engine by oVirt.

the class IrsProxy method startSpm.

private SpmStatusResult startSpm(final StoragePool storagePool, VDS selectedVds, int prevId, String lver, int vdsSpmIdToFence) {
    storagePool.setStatus(StoragePoolStatus.Contend);
    storagePool.setSpmVdsId(selectedVds.getId());
    TransactionSupport.executeInNewTransaction(() -> {
        storagePoolDao.update(storagePool);
        return null;
    });
    log.info("starting spm on vds '{}', storage pool '{}', prevId '{}', LVER '{}'", selectedVds.getName(), storagePool.getName(), prevId, lver);
    SpmStatusResult spmStatus = (SpmStatusResult) resourceManager.runVdsCommand(VDSCommandType.SpmStart, new SpmStartVDSCommandParameters(selectedVds.getId(), storagePoolId, prevId, lver, storagePool.getRecoveryMode(), vdsSpmIdToFence != -1, storagePool.getStoragePoolFormatType())).getReturnValue();
    if (spmStatus == null || spmStatus.getSpmStatus() != SpmStatus.SPM) {
        getEventListener().storagePoolStatusChange(storagePool.getId(), StoragePoolStatus.NonResponsive, AuditLogType.SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC, EngineError.ENGINE, TransactionScopeOption.RequiresNew);
        if (spmStatus != null) {
            TransactionSupport.executeInNewTransaction(() -> {
                StoragePool pool = storagePoolDao.get(storagePool.getId());
                pool.setSpmVdsId(null);
                storagePoolDao.update(pool);
                return null;
            });
        }
        throw new IrsSpmStartFailedException();
    }
    return spmStatus;
}
Also used : SpmStatusResult(org.ovirt.engine.core.common.businessentities.SpmStatusResult) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) SpmStartVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.SpmStartVDSCommandParameters)

Aggregations

SpmStatusResult (org.ovirt.engine.core.common.businessentities.SpmStatusResult)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 SpmStartVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.SpmStartVDSCommandParameters)1