use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResourceTest method getBricks.
private List<GlusterBrickEntity> getBricks() {
List<GlusterBrickEntity> bricks = new ArrayList<>();
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setId(GUIDS[0]);
brick.setServerId(serverId);
brick.setServerName(serverName);
brick.setVolumeId(volumeId);
brick.setBrickDirectory(brickDir);
bricks.add(brick);
return bricks;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResourceTest method getBrickEntitiesToRemove.
private List<GlusterBrickEntity> getBrickEntitiesToRemove() {
List<GlusterBrickEntity> bricks = new ArrayList<>();
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setId(GUIDS[0]);
brick.setVolumeId(volumeId);
bricks.add(brick);
return bricks;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResourceTest method setUpBricksQueryExpectations.
private void setUpBricksQueryExpectations(Object failure) {
QueryReturnValue queryResult = new QueryReturnValue();
queryResult.setSucceeded(failure == null);
List<GlusterBrickEntity> entities = new ArrayList<>();
if (failure == null) {
for (int i = 0; i < NAMES.length; i++) {
entities.add(getEntity(i));
}
queryResult.setReturnValue(entities);
} else {
if (failure instanceof String) {
queryResult.setExceptionString((String) failure);
setUpL10nExpectations((String) failure);
} else if (failure instanceof Exception) {
when(backend.runQuery(eq(QueryType.GetGlusterVolumeBricks), any())).thenThrow((Exception) failure);
return;
}
}
when(backend.runQuery(eq(QueryType.GetGlusterVolumeBricks), any())).thenReturn(queryResult);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterBrickMapperTest method testStatusMapping.
private void testStatusMapping(GlusterStatus backendStatus, GlusterBrickStatus restStatus) {
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setStatus(backendStatus);
GlusterBrick restBrick = GlusterBrickMapper.map(brick, null);
assertEquals(restBrick.getStatus(), restStatus);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GetGlusterVolumeGeoRepSessionsQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<GlusterGeoRepSession> geoRepSessions = glusterGeoRepDao.getGeoRepSessions(getParameters().getId());
/*
* If master volume has sessions, update the master server names in accordance with masterBrickId in sessionDetails.
*/
if (geoRepSessions != null) {
for (GlusterGeoRepSession currentSession : geoRepSessions) {
// For each session get corresponding session details.
List<GlusterGeoRepSessionDetails> geoRepSessionDetails = glusterGeoRepDao.getGeoRepSessionDetails(currentSession.getId());
/*
* Session details could be null, if they are not yet synced. possible if session detail command failed for some unexpected reason
* such as network failure even though the sessions in the cluster are synced(sessionListCommand)
*/
if (geoRepSessionDetails == null) {
continue;
}
/*
* If non null session detail, set masterBrick servername in accordance with that in brick
* as obtained by using masterbrickId
*/
for (GlusterGeoRepSessionDetails currentDetail : geoRepSessionDetails) {
if (currentDetail == null) {
continue;
}
Guid currentMasterBrickId = currentDetail.getMasterBrickId();
if (currentMasterBrickId == null) {
continue;
}
GlusterBrickEntity currentBrick = glusterBrickDao.getById(currentMasterBrickId);
if (currentBrick != null) {
currentDetail.setMasterBrickHostName(currentBrick.getServerName());
}
}
/*
* Finally set session details to the current session
*/
currentSession.setSessionDetails((ArrayList<GlusterGeoRepSessionDetails>) geoRepSessionDetails);
}
}
getQueryReturnValue().setReturnValue(geoRepSessions);
}
Aggregations