use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class StopRebalanceGlusterVolumeCommandTest method mockBackend.
private void mockBackend(boolean succeeded, JobExecutionStatus rebalanceStopStatus, boolean isRebalancegTaskCompleted, EngineError errorCode) {
doReturn("TestVDS").when(cmd).getClusterName();
doReturn("TestVolume").when(cmd).getGlusterVolumeName();
doNothing().when(cmd).endStepJob(eq(rebalanceStopStatus), any(), eq(isRebalancegTaskCompleted));
doNothing().when(cmd).releaseVolumeLock();
VDSReturnValue vdsReturnValue = new VDSReturnValue();
GlusterVolumeTaskStatusEntity rebalanceStatusEntity = new GlusterVolumeTaskStatusEntity();
rebalanceStatusEntity.getStatusSummary().setStatus(rebalanceStopStatus);
vdsReturnValue.setReturnValue(rebalanceStatusEntity);
vdsReturnValue.setSucceeded(succeeded);
if (!succeeded) {
vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
}
when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.StopRebalanceGlusterVolume), any())).thenReturn(vdsReturnValue);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class GetGlusterVolumeRemoveBricksStatusQueryTest method setupExpectedVolume.
private void setupExpectedVolume() {
expectedVolumeStatusDetails = new GlusterVolumeTaskStatusEntity();
expectedVolumeStatusDetails.setHostwiseStatusDetails(getHostwiseStatusDetails());
expectedVolumeStatusDetails.setStatusSummary(getStatusSummary());
expectedVolumeStatusDetails.setStartTime(new Date());
expectedVolumeStatusDetails.setStatusTime(new Date());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class GetGlusterVolumeRemoveBricksStatusQueryTest method testQueryForStatusDetails.
@Test
public void testQueryForStatusDetails() {
doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId();
when(vdsDao.get(SERVER_ID)).thenReturn(getVds(VDSStatus.Up));
when(glusterUtils.getUpServer(CLUSTER_ID)).thenReturn(getVds(VDSStatus.Up));
getQuery().executeQueryCommand();
GlusterVolumeTaskStatusEntity volumeStatusDetails = getQuery().getQueryReturnValue().getReturnValue();
assertNotNull(volumeStatusDetails);
assertEquals(expectedVolumeStatusDetails, volumeStatusDetails);
verify(volumeDao, times(1)).getById(VOLUME_ID);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class GetGlusterVolumeRemoveBricksStatusQuery method fetchTaskStatusDetails.
@Override
protected GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() {
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount()));
GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue();
// Update the latest status details
GlusterAsyncTask asyncTask = volume.getAsyncTask();
if (asyncTask != null) {
// take a copy of the task status with engine for further use
JobExecutionStatus jobStatusWithEngine = volume.getAsyncTask().getStatus();
// update the status entity with required details
updateStatusEntity(entity);
// be set to aborted. This is required only in case of remove bricks
if (jobStatusWithEngine == JobExecutionStatus.ABORTED) {
entity.getStatusSummary().setStatus(JobExecutionStatus.ABORTED);
}
}
return entity;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class GetGlusterVolumeRebalanceStatusQueryTest method testQueryForStatusDetails.
@Test
public void testQueryForStatusDetails() {
doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId();
when(vdsDao.get(SERVER_ID)).thenReturn(getVds(VDSStatus.Up));
when(glusterUtils.getUpServer(CLUSTER_ID)).thenReturn(getVds(VDSStatus.Up));
getQuery().executeQueryCommand();
GlusterVolumeTaskStatusEntity volumeStatusDetails = getQuery().getQueryReturnValue().getReturnValue();
assertNotNull(volumeStatusDetails);
assertEquals(expectedVolumeStatusDetails, volumeStatusDetails);
verify(volumeDao, times(1)).getById(VOLUME_ID);
}
Aggregations