use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class IrsProxy method proceedStoragePoolStats.
@SuppressWarnings("unchecked")
private void proceedStoragePoolStats(StoragePool storagePool) {
// ugly patch because vdsm doesnt check if host is spm on spm
// operations
VDSReturnValue result = null;
Guid curVdsId = currentVdsId;
if (curVdsId != null) {
result = resourceManager.runVdsCommand(VDSCommandType.SpmStatus, new SpmStatusVDSCommandParameters(curVdsId, storagePoolId));
}
if (result == null || !result.getSucceeded() || (result.getSucceeded() && ((SpmStatusResult) result.getReturnValue()).getSpmStatus() != SpmStatus.SPM)) {
// update pool status to problematic until fence will happen
if (storagePool.getStatus() != StoragePoolStatus.NonResponsive && storagePool.getStatus() != StoragePoolStatus.NotOperational) {
if (result != null && result.getVdsError() != null) {
updateStoragePoolStatus(storagePoolId, StoragePoolStatus.NonResponsive, AuditLogType.SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC_WITH_ERROR, result.getVdsError().getCode());
} else {
updateStoragePoolStatus(storagePoolId, StoragePoolStatus.NonResponsive, AuditLogType.SYSTEM_CHANGE_STORAGE_POOL_STATUS_PROBLEMATIC, EngineError.ENGINE);
}
}
// then cause failover with attempts
if (result != null && !(result.getExceptionObject() instanceof VDSNetworkException)) {
HashMap<Guid, AsyncTaskStatus> tasksList = (HashMap<Guid, AsyncTaskStatus>) resourceManager.runVdsCommand(VDSCommandType.HSMGetAllTasksStatuses, new VdsIdVDSCommandParametersBase(curVdsId)).getReturnValue();
boolean allTasksFinished = true;
if (tasksList != null) {
for (AsyncTaskStatus taskStatus : tasksList.values()) {
if (AsyncTaskStatusEnum.finished != taskStatus.getStatus()) {
allTasksFinished = false;
break;
}
}
}
if ((tasksList == null) || allTasksFinished) {
nullifyInternalProxies();
} else {
if (_errorAttempts < Config.<Integer>getValue(ConfigValues.SPMFailOverAttempts)) {
_errorAttempts++;
log.warn("failed getting spm status for pool '{}' ({}), attempt number: {}", storagePoolId, storagePool.getName(), _errorAttempts);
} else {
nullifyInternalProxies();
_errorAttempts = 0;
}
}
}
} else if (result.getSucceeded() && ((SpmStatusResult) result.getReturnValue()).getSpmStatus() == SpmStatus.SPM && (storagePool.getStatus() == StoragePoolStatus.NonResponsive || storagePool.getStatus() == StoragePoolStatus.Contend)) {
// if recovered from network exception set back to up
storagePoolDao.updateStatus(storagePool.getId(), StoragePoolStatus.Up);
storagePool.setStatus(StoragePoolStatus.Up);
getEventListener().storagePoolStatusChanged(storagePool.getId(), storagePool.getStatus());
}
List<StorageDomain> domainsInDb = storageDomainDao.getAllForStoragePool(storagePoolId);
GetStoragePoolInfoVDSCommandParameters tempVar = new GetStoragePoolInfoVDSCommandParameters(storagePoolId);
tempVar.setIgnoreFailoverLimit(true);
VDSReturnValue storagePoolInfoResult = resourceManager.runVdsCommand(VDSCommandType.GetStoragePoolInfo, tempVar);
if (storagePoolInfoResult.getSucceeded()) {
KeyValuePairCompat<StoragePool, List<StorageDomain>> data = (KeyValuePairCompat<StoragePool, List<StorageDomain>>) storagePoolInfoResult.getReturnValue();
int masterVersion = data.getKey().getMasterDomainVersion();
HashSet<Guid> domainsInVds = new HashSet<>();
List<StorageDomain> storageDomainsToSync = data.getValue().stream().peek(storageDomain -> domainsInVds.add(storageDomain.getId())).filter(storageDomain -> proceedStorageDomain(storageDomain, masterVersion, storagePool)).collect(Collectors.toList());
if (!storageDomainsToSync.isEmpty()) {
getEventListener().syncStorageDomainsLuns(getCurrentVdsId(), storageDomainsToSync.stream().map(StorageDomain::getId).collect(Collectors.toList()));
}
for (final StorageDomain domainInDb : domainsInDb) {
if (domainInDb.getStorageDomainType() != StorageDomainType.Master && domainInDb.getStatus() != StorageDomainStatus.Locked && !domainInDb.getStorageType().isCinderDomain() && !domainsInVds.contains(domainInDb.getId())) {
// domain not attached to pool anymore
storagePoolIsoMapDao.remove(new StoragePoolIsoMapId(domainInDb.getId(), storagePoolId));
}
}
}
domainsInMaintenanceCheck(domainsInDb, storagePool);
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class GlusterMonitoringStrategy method processSoftwareCapabilities.
@Override
public void processSoftwareCapabilities(VDS vds) {
// check if gluster is running
VDSReturnValue returnValue = resourceManager.get().runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(vds.getId()));
if (!returnValue.getSucceeded()) {
vds.setStatus(VDSStatus.NonOperational);
vds.setNonOperationalReason(NonOperationalReason.GLUSTER_COMMAND_FAILED);
vdsNonOperational(vds, NonOperationalReason.GLUSTER_COMMAND_FAILED);
}
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class GetAddedGlusterServersQuery method executeQueryCommand.
@Override
@SuppressWarnings("unchecked")
protected void executeQueryCommand() {
Map<String, String> glusterServers = new HashMap<>();
VDS upServer = glusterUtil.getUpServer(getParameters().getClusterId());
if (upServer != null) {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServer.getId()));
glusterServers = getAddedGlusterServers((List<GlusterServerInfo>) returnValue.getReturnValue());
}
getQueryReturnValue().setReturnValue(glusterServers);
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class GetGlusterVolumeOptionsInfoQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeOptionsInfo, new VdsIdVDSCommandParametersBase(getUpServerId(getParameters().getClusterId())));
getQueryReturnValue().setReturnValue(returnValue.getReturnValue());
}
use of org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase in project ovirt-engine by oVirt.
the class GlusterTasksService method getTaskListForCluster.
public Map<Guid, GlusterAsyncTask> getTaskListForCluster(Guid id) {
VDS upServer = glusterUtil.getRandomUpServer(id);
if (upServer == null) {
log.info("No up server in cluster");
return null;
}
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterTasksList, new VdsIdVDSCommandParametersBase(upServer.getId()));
if (returnValue.getSucceeded()) {
List<GlusterAsyncTask> tasks = (List<GlusterAsyncTask>) returnValue.getReturnValue();
Map<Guid, GlusterAsyncTask> tasksMap = new HashMap<>();
for (GlusterAsyncTask task : tasks) {
tasksMap.put(task.getTaskId(), task);
}
return tasksMap;
} else {
log.error("Error: {}", returnValue.getVdsError());
throw new EngineException(EngineError.GlusterVolumeStatusAllFailedException, returnValue.getVdsError().getMessage());
}
}
Aggregations