use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class StopRebalanceGlusterVolumeCommandTest method getVolumeWithRebalanceTask.
private GlusterVolumeEntity getVolumeWithRebalanceTask(Guid volumeId) {
GlusterVolumeEntity volume = getVolume(volumeId);
GlusterAsyncTask asyncTask = new GlusterAsyncTask();
asyncTask.setStatus(JobExecutionStatus.STARTED);
asyncTask.setType(GlusterTaskType.REBALANCE);
volume.setAsyncTask(asyncTask);
return volume;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class StopRemoveGlusterVolumeBricksCommandTest method getVolumeWithRemoveBricksTaskCompleted.
private Object getVolumeWithRemoveBricksTaskCompleted(Guid volumeId) {
GlusterVolumeEntity volume = getVolumeWithRemoveBricksTask(volumeId);
volume.getAsyncTask().setStatus(JobExecutionStatus.FINISHED);
return volume;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class GlusterDBUtils method isVolumeSnapshotHardLimitReached.
public boolean isVolumeSnapshotHardLimitReached(Guid volumeId) {
GlusterVolumeEntity volume = glusterVolumeDao.getById(volumeId);
if (volume != null) {
GlusterVolumeSnapshotConfig config = glusterVolumeSnapshotConfigDao.getConfigByVolumeIdAndName(volume.getClusterId(), volumeId, "snap-max-hard-limit");
if (config != null) {
int snapMaxHardLimit = Integer.parseInt(config.getParamValue());
int snapshotCount = volume.getSnapshotsCount();
return snapshotCount >= snapMaxHardLimit;
}
}
return false;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class GlusterVolumeDaoTest method testRemoveAccessProtocol.
@Test
public void testRemoveAccessProtocol() {
Set<AccessProtocol> protocols = existingReplVol.getAccessProtocols();
assertEquals(2, protocols.size());
assertTrue(protocols.contains(AccessProtocol.NFS));
dao.removeAccessProtocol(EXISTING_VOL_REPL_ID, AccessProtocol.NFS);
GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_REPL_ID);
assertNotNull(volumeAfter);
protocols = volumeAfter.getAccessProtocols();
assertEquals(1, protocols.size());
assertFalse(protocols.contains(AccessProtocol.NFS));
assertFalse(volumeAfter.equals(existingReplVol));
existingReplVol.removeAccessProtocol(AccessProtocol.NFS);
assertEquals(volumeAfter, existingReplVol);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class GlusterVolumeDaoTest method testUpdateVolumeCapacityInfo.
@Test
public void testUpdateVolumeCapacityInfo() {
GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
capacityInfo.setVolumeId(existingDistVol.getId());
capacityInfo.setTotalSize(Long.valueOf("500000"));
capacityInfo.setFreeSize(Long.valueOf("300000"));
capacityInfo.setUsedSize(Long.valueOf("200000"));
dao.updateVolumeCapacityInfo(capacityInfo);
GlusterVolumeEntity volume = dao.getById(existingDistVol.getId());
assertNotNull(volume);
assertFalse(volume.equals(existingDistVol));
assertNotNull("volume capacity info is not available", volume.getAdvancedDetails().getCapacityInfo());
assertTrue(volume.getAdvancedDetails().getCapacityInfo().getTotalSize() == 500000);
assertTrue(volume.getAdvancedDetails().getCapacityInfo().getUsedSize() == 200000);
assertTrue(volume.getAdvancedDetails().getCapacityInfo().getFreeSize() == 300000);
assertNotNull(volume.getAdvancedDetails().getUpdatedAt());
}
Aggregations