use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterGeoRepSyncJobTest method getVolume.
private GlusterVolumeEntity getVolume() {
GlusterVolumeEntity volume = new GlusterVolumeEntity();
volume.setName("VOL1");
volume.setClusterId(Guid.newGuid());
volume.setId(Guid.newGuid());
volume.setReplicaCount(2);
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setVolumeId(volume.getId());
brick.setBrickDirectory("/export/testvol1");
brick.setStatus(GlusterStatus.UP);
brick.setBrickOrder(0);
volume.addBrick(brick);
GlusterBrickEntity brick2 = new GlusterBrickEntity();
brick2.setVolumeId(volume.getId());
brick2.setBrickDirectory("/export/testvol1");
brick2.setStatus(GlusterStatus.UP);
brick2.setBrickOrder(1);
volume.addBrick(brick2);
return volume;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterHostValidatorTest method getGlusterBrick.
private GlusterBrickEntity getGlusterBrick(GlusterStatus status, Guid serverId) {
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setStatus(status);
brick.setServerId(serverId);
return brick;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterSyncJobTest method getVolumeAdvancedDetails.
private GlusterVolumeAdvancedDetails getVolumeAdvancedDetails(GlusterVolumeEntity volume) {
GlusterVolumeAdvancedDetails volDetails = new GlusterVolumeAdvancedDetails();
GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
capacityInfo.setVolumeId(volume.getId());
capacityInfo.setTotalSize(600000L);
capacityInfo.setFreeSize(200000L);
capacityInfo.setUsedSize(400000L);
volDetails.setCapacityInfo(capacityInfo);
List<BrickDetails> brickDetailsList = new ArrayList<>();
for (GlusterBrickEntity brick : volume.getBricks()) {
BrickDetails brickDetails = new BrickDetails();
BrickProperties properties = new BrickProperties();
properties.setBrickId(brick.getId());
brickDetails.setBrickProperties(properties);
properties.setStatus(brick.getStatus());
if (volume == existingReplVol) {
if (brick.getServerId().equals(SERVER_ID_1) && (brick.getBrickDirectory().equals(REPL_BRICK_R1D1) || brick.getBrickDirectory().equals(REPL_BRICK_R2D1))) {
properties.setStatus(GlusterStatus.DOWN);
bricksWithChangedStatus.add(brick);
}
}
brickDetailsList.add(brickDetails);
}
volDetails.setBrickDetails(brickDetailsList);
return volDetails;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterSyncJobTest method getNewVolume.
private GlusterVolumeEntity getNewVolume() {
GlusterVolumeEntity volume = new GlusterVolumeEntity();
volume.setName(NEW_VOL_NAME);
volume.setClusterId(CLUSTER_ID);
volume.setId(NEW_VOL_ID);
volume.setVolumeType(GlusterVolumeType.DISTRIBUTE);
volume.addTransportType(TransportType.TCP);
volume.setReplicaCount(0);
volume.setStripeCount(0);
volume.setStatus(GlusterStatus.UP);
volume.setOption("auth.allow", "*");
volume.addAccessProtocol(AccessProtocol.GLUSTER);
volume.addAccessProtocol(AccessProtocol.NFS);
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setVolumeId(NEW_VOL_ID);
brick.setServerId(existingServer1.getId());
brick.setServerName(existingServer1.getHostName());
brick.setBrickDirectory("/export/testvol1");
brick.setStatus(GlusterStatus.UP);
brick.setBrickOrder(0);
volume.addBrick(brick);
return volume;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterSyncJobTest method getFetchedVolumesList.
/**
* Returns the list of volumes as if they were fetched from glusterfs. Changes from existing volumes are:<br>
* - existingDistVol not fetched (means it was removed from gluster cli, and should be removed from db<br>
* - option 'auth.allow' removed from the existingReplVol<br>
* - new option 'auth.reject' added to existingReplVol<br>
* - value of option 'nfs.disable' changed from 'off' ot 'on' in existingReplVol<br>
* - new volume test-new-vol fetched from gluster (means it was added from gluster cli, and should be added to db<br>
*/
private Map<Guid, GlusterVolumeEntity> getFetchedVolumesList() {
Map<Guid, GlusterVolumeEntity> volumes = new HashMap<>();
GlusterVolumeEntity fetchedReplVol = createReplVol();
// option removed
fetchedReplVol.removeOption(OPTION_AUTH_ALLOW);
// added
fetchedReplVol.setOption(OPTION_AUTH_REJECT, AUTH_REJECT_IP);
// changed
fetchedReplVol.setOption(OPTION_NFS_DISABLE, OPTION_VALUE_ON);
// brick changes
removedBrickIds.add(GlusterCoreUtil.findBrick(existingReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R1D1).getId());
removedBrickIds.add(GlusterCoreUtil.findBrick(existingReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R2D1).getId());
GlusterBrickEntity brickToReplace = GlusterCoreUtil.findBrick(fetchedReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R1D1);
replaceBrick(brickToReplace, SERVER_ID_1, REPL_BRICK_R1D1_NEW);
brickToReplace = GlusterCoreUtil.findBrick(fetchedReplVol.getBricks(), SERVER_ID_1, REPL_BRICK_R2D1);
replaceBrick(brickToReplace, SERVER_ID_1, REPL_BRICK_R2D1_NEW);
volumes.put(fetchedReplVol.getId(), fetchedReplVol);
// add a new volume
newVolume = getNewVolume();
volumes.put(newVolume.getId(), newVolume);
return volumes;
}
Aggregations