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);
}
Aggregations