Search in sources :

Example 1 with ActivateStorageDomainVDSCommandParameters

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

the class ActivateStorageDomainCommand method executeCommand.

@Override
protected void executeCommand() {
    if (isCinderStorageDomain()) {
        activateCinderStorageDomain();
        return;
    }
    final StoragePoolIsoMap map = storagePoolIsoMapDao.get(new StoragePoolIsoMapId(getParameters().getStorageDomainId(), getParameters().getStoragePoolId()));
    // Master domain must not go through the Activating status.
    changeStorageDomainStatusInTransaction(map, (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) ? StorageDomainStatus.Locked : StorageDomainStatus.Activating);
    freeLock();
    log.info("ActivateStorage Domain. Before Connect all hosts to pool. Time: {}", new Date());
    List<Pair<Guid, Boolean>> hostsConnectionResults = connectHostsInUpToDomainStorageServer();
    if (isAllHostConnectionFailed(hostsConnectionResults)) {
        log.error("Cannot connect storage server, aborting Storage Domain activation.");
        setSucceeded(false);
        return;
    }
    syncStorageDomainInfo(hostsConnectionResults);
    runVdsCommand(VDSCommandType.ActivateStorageDomain, new ActivateStorageDomainVDSCommandParameters(getStoragePool().getId(), getStorageDomain().getId()));
    log.info("ActivateStorage Domain. After Connect all hosts to pool. Time: {}", new Date());
    TransactionSupport.executeInNewTransaction(() -> {
        map.setStatus(StorageDomainStatus.Active);
        storagePoolIsoMapDao.updateStatus(map.getId(), map.getStatus());
        if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) {
            calcStoragePoolStatusByDomainsStatus();
        }
        return null;
    });
    refreshAllVdssInPool();
    log.info("ActivateStorage Domain. After change storage pool status in vds. Time: {}", new Date());
    if (getStorageDomain().getStorageDomainType() == StorageDomainType.ISO) {
        isoDomainListSynchronizer.refresheIsoDomainWhenActivateDomain(getStorageDomain().getId(), getStoragePool().getId());
    }
    setSucceeded(true);
}
Also used : StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) StoragePoolIsoMapId(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId) ActivateStorageDomainVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.ActivateStorageDomainVDSCommandParameters) Date(java.util.Date) Pair(org.ovirt.engine.core.common.utils.Pair)

Aggregations

Date (java.util.Date)1 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)1 StoragePoolIsoMapId (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId)1 Pair (org.ovirt.engine.core.common.utils.Pair)1 ActivateStorageDomainVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.ActivateStorageDomainVDSCommandParameters)1