use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.
the class SubTabVolumeBrickView method initTable.
void initTable() {
getTable().enableColumnResizing();
BrickStatusColumn brickStatusColumn = new BrickStatusColumn();
brickStatusColumn.setContextMenuTitle(constants.statusVolumeBrick());
brickStatusColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(brickStatusColumn, constants.empty(), "30px");
AbstractTextColumn<GlusterBrickEntity> serverColumn = new AbstractTextColumn<GlusterBrickEntity>() {
@Override
public String getValue(GlusterBrickEntity brick) {
return brick.getServerName();
}
};
serverColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(serverColumn, constants.serverVolumeBrick(), "300px");
AbstractTextColumn<GlusterBrickEntity> directoryColumn = new AbstractTextColumn<GlusterBrickEntity>() {
@Override
public String getValue(GlusterBrickEntity brick) {
String qualifiedName = brick.getQualifiedName();
if (brick.getIsArbiter()) {
// $NON-NLS-1$ //$NON-NLS-2$
qualifiedName += " (" + constants.arbiter() + ")";
}
return qualifiedName;
}
};
directoryColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(directoryColumn, constants.brickDirectoryVolumeBrick(), "400px");
getTable().addColumn(new Column<GlusterBrickEntity, BrickProperties>(new BrickCapacityCell()) {
@Override
public BrickProperties getValue(GlusterBrickEntity object) {
return object.getBrickProperties();
}
}, constants.volumeCapacity(), // $NON-NLS-1$
"100px");
BrickHealInfoColumn healInfoColumn = new BrickHealInfoColumn();
// $NON-NLS-1$
getTable().addColumn(healInfoColumn, constants.healInfo(), "110px");
getTable().addColumn(new VolumeActivityColumn<GlusterBrickEntity>(getActivityCell()), constants.activitiesOnVolume(), // $NON-NLS-1$
"100px");
}
use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.
the class GlusterBrickDetailMapper method mapBrickProperties.
private static GlusterBrick mapBrickProperties(BrickDetails detail, GlusterBrick model) {
if (detail.getBrickProperties() != null) {
BrickProperties props = detail.getBrickProperties();
if (StringUtils.isNotEmpty(props.getDevice())) {
model.setDevice(props.getDevice());
}
if (StringUtils.isNotEmpty(props.getFsName())) {
model.setFsName(props.getFsName());
}
if (StringUtils.isNotEmpty(props.getMntOptions())) {
model.setMntOptions(props.getMntOptions());
}
model.setPid(props.getPid());
model.setPort(props.getPort());
}
return model;
}
use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.
the class GlusterSyncJob method refreshVolumeDetails.
public void refreshVolumeDetails(VDS upServer, GlusterVolumeEntity volume) {
List<GlusterBrickEntity> bricksToUpdate = new ArrayList<>();
List<GlusterBrickEntity> brickPropertiesToUpdate = new ArrayList<>();
List<GlusterBrickEntity> brickPropertiesToAdd = new ArrayList<>();
GlusterVolumeAdvancedDetails volumeAdvancedDetails = getVolumeAdvancedDetails(upServer, volume.getClusterId(), volume.getName());
if (volumeAdvancedDetails == null) {
log.error("Error while refreshing brick statuses for volume '{}'. Failed to get volume advanced details ", volume.getName());
return;
}
if (volumeAdvancedDetails.getCapacityInfo() != null) {
if (volume.getAdvancedDetails().getCapacityInfo() == null) {
volumeDao.addVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo());
} else {
volumeDao.updateVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo());
}
}
Map<Guid, BrickProperties> brickPropertiesMap = getBrickPropertiesMap(volumeAdvancedDetails);
for (GlusterBrickEntity brick : volume.getBricks()) {
BrickProperties brickProperties = brickPropertiesMap.get(brick.getId());
if (brickProperties != null) {
if (brickProperties.getStatus() != brick.getStatus()) {
logBrickStatusChange(volume, brick, brickProperties.getStatus());
brick.setStatus(brickProperties.getStatus());
bricksToUpdate.add(brick);
}
if (brick.getBrickProperties() == null) {
BrickDetails brickDetails = new BrickDetails();
brickDetails.setBrickProperties(brickProperties);
brick.setBrickDetails(brickDetails);
brickPropertiesToAdd.add(brick);
} else if (brickProperties.getTotalSize() != brick.getBrickProperties().getTotalSize() || brickProperties.getFreeSize() != brick.getBrickProperties().getFreeSize()) {
brick.getBrickDetails().setBrickProperties(brickProperties);
brickPropertiesToUpdate.add(brick);
}
}
}
if (!brickPropertiesToAdd.isEmpty()) {
brickDao.addBrickProperties(brickPropertiesToAdd);
}
if (!brickPropertiesToUpdate.isEmpty()) {
brickDao.updateBrickProperties(brickPropertiesToUpdate);
}
if (!bricksToUpdate.isEmpty()) {
brickDao.updateBrickStatuses(bricksToUpdate);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties 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.BrickProperties in project ovirt-engine by oVirt.
the class GetGlusterVolumeAdvancedDetailsQueryTest method getBrickProperties.
private BrickProperties getBrickProperties() {
BrickProperties brickProperties = new BrickProperties();
brickProperties.setBrickId(Guid.newGuid());
brickProperties.setPort(24009);
brickProperties.setStatus(GlusterStatus.UP);
brickProperties.setPid(1459);
return brickProperties;
}
Aggregations