use of org.ovirt.engine.core.common.vdscommands.ConnectStoragePoolVDSCommandParameters in project ovirt-engine by oVirt.
the class ReconstructMasterDomainCommand method connectAndRefreshAllUpHosts.
private void connectAndRefreshAllUpHosts(final boolean commandSucceeded) {
if (isLastMaster || !commandSucceeded) {
log.warn("skipping connect and refresh for all hosts, last master '{}', command status '{}'", isLastMaster, commandSucceeded);
return;
}
List<Callable<Void>> tasks = new ArrayList<>();
for (final VDS vds : getAllRunningVdssInPool()) {
tasks.add(() -> {
try {
if (!connectVdsToNewMaster(vds)) {
log.warn("failed to connect vds '{}' to the new master '{}'", vds.getId(), getNewMasterStorageDomainId());
return null;
}
List<StoragePoolIsoMap> storagePoolIsoMap = storagePoolIsoMapDao.getAllForStoragePool(getStoragePool().getId());
try {
runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds, getStoragePool(), getNewMasterStorageDomainId(), storagePoolIsoMap, true));
} catch (EngineException ex) {
if (EngineError.StoragePoolUnknown == ex.getVdsError().getCode()) {
VDSReturnValue returnVal = runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds, getStoragePool(), getNewMasterStorageDomainId(), storagePoolIsoMap));
if (!returnVal.getSucceeded()) {
log.error("Post reconstruct actions (connectPool) did not complete on host '{}' in the pool. error {}", vds.getId(), returnVal.getVdsError().getMessage());
}
} else {
log.error("Post reconstruct actions (refreshPool)" + " did not complete on host '{}' in the pool. error {}", vds.getId(), ex.getMessage());
}
}
} catch (Exception e) {
log.error("Post reconstruct actions (connectPool,refreshPool,disconnect storage)" + " did not complete on host '{}' in the pool: {}", vds.getId(), e.getMessage());
log.debug("Exception", e);
}
return null;
});
}
ThreadPoolUtil.invokeAll(tasks);
}
use of org.ovirt.engine.core.common.vdscommands.ConnectStoragePoolVDSCommandParameters in project ovirt-engine by oVirt.
the class RefreshStoragePoolAndDisconnectAsyncOperation method execute.
@Override
public void execute(int iterationId) {
try {
resourceManager.runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(getVdss().get(iterationId), getStoragePool(), masterStorageDomainId, storagePoolIsoMap, true));
storageHelperDirector.getItem(getStorageDomain().getStorageType()).disconnectStorageFromDomainByVdsId(getStorageDomain(), getVdss().get(iterationId).getId());
} catch (RuntimeException e) {
log.error("Failed to connect/refresh storagePool. Host '{}' to storage pool '{}': {}", getVdss().get(iterationId).getName(), getStoragePool().getName(), e.getMessage());
log.debug("Exception", e);
}
}
use of org.ovirt.engine.core.common.vdscommands.ConnectStoragePoolVDSCommandParameters in project ovirt-engine by oVirt.
the class InitVdsOnUpCommand method runConnectHostToPoolEvent.
private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) {
EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL);
StoragePool storagePool = storagePoolDao.get(storagePoolId);
StorageDomain masterDomain = storageDomainDao.getStorageDomains(storagePoolId, StorageDomainType.Master).get(0);
List<StoragePoolIsoMap> storagePoolIsoMap = storagePoolIsoMapDao.getAllForStoragePool(storagePoolId);
boolean masterDomainInactiveOrUnknown = masterDomain.getStatus() == StorageDomainStatus.Inactive || masterDomain.getStatus() == StorageDomainStatus.Unknown;
VDSError error = null;
try {
VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds, storagePool, masterDomain.getId(), storagePoolIsoMap));
if (!vdsReturnValue.getSucceeded()) {
error = vdsReturnValue.getVdsError();
}
} catch (EngineException e) {
error = e.getVdsError();
}
if (error != null) {
if (error.getCode() != EngineError.CannotConnectMultiplePools && masterDomainInactiveOrUnknown) {
log.info("Could not connect host '{}' to pool '{}', as the master domain is in inactive/unknown" + " status - not failing the operation", vds.getName(), storagePool.getName());
} else {
log.error("Could not connect host '{}' to pool '{}': {}", vds.getName(), storagePool.getName(), error.getMessage());
result.setSuccess(false);
}
}
if (result.isSuccess()) {
Pair<Boolean, List<StorageDomainStatic>> vdsStatsResults = proceedVdsStats(!masterDomainInactiveOrUnknown, storagePool);
result.setSuccess(vdsStatsResults.getFirst());
if (!result.isSuccess()) {
result.setResultData(vdsStatsResults.getSecond());
auditLogDirector.log(this, AuditLogType.VDS_STORAGE_VDS_STATS_FAILED);
}
}
return result;
}
use of org.ovirt.engine.core.common.vdscommands.ConnectStoragePoolVDSCommandParameters in project ovirt-engine by oVirt.
the class IrsProxy method connectStoragePool.
private void connectStoragePool(VDS vds, StoragePool storagePool) {
Guid masterDomainId = storageDomainDao.getMasterStorageDomainIdForPool(storagePoolId);
List<StoragePoolIsoMap> storagePoolIsoMap = storagePoolIsoMapDao.getAllForStoragePool(storagePoolId);
VDSReturnValue connectResult = resourceManager.runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds, storagePool, masterDomainId, storagePoolIsoMap));
if (!connectResult.getSucceeded() && connectResult.getExceptionObject() instanceof IRSNoMasterDomainException) {
throw connectResult.getExceptionObject();
} else if (!connectResult.getSucceeded()) {
// failover
throw new IRSNonOperationalException("Could not connect host to Data Center(Storage issue)");
}
}
use of org.ovirt.engine.core.common.vdscommands.ConnectStoragePoolVDSCommandParameters in project ovirt-engine by oVirt.
the class RefreshPoolSingleAsyncOperation method execute.
@Override
public void execute(int iterationId) {
try {
if (getStorageDomain() != null && getStorageDomain().getStorageDomainType() == StorageDomainType.Master) {
try {
resourceManager.runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(getVdss().get(iterationId), getStoragePool(), masterStorageDomainId, storagePoolIsoMap));
} catch (Exception e) {
log.error("Could not connect vds '{}' to pool '{}' - moving host to non-operational: {}", getVdss().get(iterationId).getName(), getStoragePool().getName(), e.getMessage());
log.debug("Exception", e);
synchronized (vdsIdsToSetNonOperational) {
vdsIdsToSetNonOperational.add(getVdss().get(iterationId).getId());
}
}
} else {
resourceManager.runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(getVdss().get(iterationId), getStoragePool(), masterStorageDomainId, storagePoolIsoMap, true));
log.info("Refreshed vds '{}' in pool '{}'", getVdss().get(iterationId).getName(), getStoragePool().getName());
}
} catch (RuntimeException e) {
log.error("Failed to connect/refresh storagePool. Host '{}' to storage pool '{}': {}", getVdss().get(iterationId).getName(), getStoragePool().getName(), e.getMessage());
log.debug("Exception", e);
}
}
Aggregations