use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.
the class UpdateGlusterHookCommandTest method mockBackend.
private void mockBackend(boolean succeeded, EngineError errorCode) {
VDSReturnValue vdsReturnValue = new VDSReturnValue();
vdsReturnValue.setSucceeded(succeeded);
if (!succeeded) {
vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
}
when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.UpdateGlusterHook), any())).thenReturn(vdsReturnValue);
}
use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.
the class UpdateGlusterHookCommandTest method mockForReadContent.
private void mockForReadContent(boolean succeeded, EngineError errorCode) {
when(hooksDao.getGlusterServerHook(HOOK_ID, SERVER_ID)).thenReturn(getGlusterServerHook(0, GlusterHookStatus.ENABLED));
mockBackend(succeeded, errorCode);
VDSReturnValue vdsReturnValue = new VDSReturnValue();
vdsReturnValue.setReturnValue(CONTENT);
vdsReturnValue.setSucceeded(succeeded);
if (!succeeded) {
vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
}
when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.GetGlusterHookContent), any())).thenReturn(vdsReturnValue);
}
use of org.ovirt.engine.core.common.errors.VDSError 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.errors.VDSError in project ovirt-engine by oVirt.
the class GlusterHookCommandTest method mockBackendStatusChange.
protected void mockBackendStatusChange(boolean succeeded, EngineError errorCode) {
VDSReturnValue vdsReturnValue = new VDSReturnValue();
vdsReturnValue.setReturnValue(succeeded);
vdsReturnValue.setSucceeded(succeeded);
if (!succeeded) {
vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
}
when(vdsBrokerFrontend.runVdsCommand(any(), any())).thenReturn(vdsReturnValue);
}
use of org.ovirt.engine.core.common.errors.VDSError in project ovirt-engine by oVirt.
the class RemoveGlusterHookCommandTest method mockBackend.
private void mockBackend(boolean succeeded, EngineError errorCode) {
VDSReturnValue vdsReturnValue = new VDSReturnValue();
vdsReturnValue.setSucceeded(succeeded);
if (!succeeded) {
vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
}
when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.RemoveGlusterHook), any())).thenReturn(vdsReturnValue);
}
Aggregations