use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class GlusterVolumeDaoImpl method fetchRelatedEntities.
/**
* Fetches and populates related entities like bricks, options, access protocols for the given volume
*/
private void fetchRelatedEntities(GlusterVolumeEntity volume) {
if (volume != null) {
volume.setOptions(glusterOptionDao.getOptionsOfVolume(volume.getId()));
volume.setAccessProtocols(new HashSet<>(getAccessProtocolsOfVolume(volume.getId())));
volume.setTransportTypes(new HashSet<>(getTransportTypesOfVolume(volume.getId())));
GlusterVolumeAdvancedDetails advancedDetails = fetchAdvancedDatails(volume.getId());
if (advancedDetails != null) {
volume.setAdvancedDetails(advancedDetails);
}
GlusterAsyncTask asyncTask = getAsyncTaskOfVolume(volume.getId());
if (asyncTask != null) {
volume.setAsyncTask(asyncTask);
}
List<GlusterBrickEntity> bricks = glusterBrickDao.getBricksOfVolume(volume.getId());
if (volume.getAsyncTask() != null && volume.getAsyncTask().getTaskId() != null) {
bricks.stream().filter(brick -> brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volume.getAsyncTask().getTaskId())).forEach(brick -> brick.setAsyncTask(volume.getAsyncTask()));
}
volume.setBricks(bricks);
GlusterVolumeSnapshotConfig config = glusterVolumeSnapshotConfigDao.getConfigByVolumeIdAndName(volume.getClusterId(), volume.getId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT);
if (config == null || StringUtils.isEmpty(config.getParamValue())) {
config = glusterVolumeSnapshotConfigDao.getConfigByClusterIdAndName(volume.getClusterId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT);
}
volume.setSnapMaxLimit(config != null ? Integer.parseInt(config.getParamValue()) : 0);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class VolumeBrickListModel method onShowBrickAdvancedDetails.
private void onShowBrickAdvancedDetails(GlusterVolumeEntity volumeEntity) {
final GlusterBrickEntity brickEntity = getSelectedItem();
final BrickAdvancedDetailsModel brickModel = new BrickAdvancedDetailsModel();
setWindow(brickModel);
brickModel.setTitle(ConstantsManager.getInstance().getConstants().advancedDetailsBrickTitle());
brickModel.setHelpTag(HelpTag.brick_advanced);
// $NON-NLS-1$
brickModel.setHashName("brick_advanced");
brickModel.startProgress();
AsyncDataProvider.getInstance().getGlusterVolumeBrickDetails(new AsyncQuery<QueryReturnValue>(returnValue -> {
brickModel.stopProgress();
if (returnValue == null || !returnValue.getSucceeded()) {
brickModel.setMessage(ConstantsManager.getInstance().getConstants().errorInFetchingBrickAdvancedDetails());
return;
}
GlusterVolumeAdvancedDetails advDetails = returnValue.getReturnValue();
brickModel.getBrick().setEntity(brickEntity.getQualifiedName());
if (advDetails != null && advDetails.getBrickDetails() != null && advDetails.getBrickDetails().size() == 1) {
BrickDetails brickDetails = advDetails.getBrickDetails().get(0);
brickModel.getBrickProperties().setProperties(brickDetails.getBrickProperties());
ArrayList<EntityModel<GlusterClientInfo>> clients = new ArrayList<>();
for (GlusterClientInfo client : brickDetails.getClients()) {
clients.add(new EntityModel<>(client));
}
brickModel.getClients().setItems(clients);
brickModel.getMemoryStatistics().updateMemoryStatistics(brickDetails.getMemoryStatus().getMallInfo());
ArrayList<EntityModel<Mempool>> memoryPools = new ArrayList<>();
for (Mempool mempool : brickDetails.getMemoryStatus().getMemPools()) {
memoryPools.add(new EntityModel<>(mempool));
}
brickModel.getMemoryPools().setItems(memoryPools);
}
}, true), volumeEntity.getClusterId(), volumeEntity.getId(), brickEntity.getId());
// $NON-NLS-1$
UICommand command = new UICommand("Cancel", this);
command.setTitle(ConstantsManager.getInstance().getConstants().close());
command.setIsCancel(true);
brickModel.getCommands().add(command);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class VolumeCapacityCell method render.
@Override
public void render(Context context, GlusterVolumeEntity object, SafeHtmlBuilder sb, String id) {
GlusterVolumeAdvancedDetails advancedDetails = object.getAdvancedDetails();
GlusterVolumeSizeInfo sizeInfo = null;
if (advancedDetails != null) {
sizeInfo = advancedDetails.getCapacityInfo();
if (sizeInfo != null) {
setFreeSize(sizeInfo.getFreeSize().doubleValue());
setTotalSize(sizeInfo.getTotalSize().doubleValue());
setUsedSize(sizeInfo.getUsedSize().doubleValue());
setInUnit(SizeUnit.BYTES);
}
}
super.render(context, advancedDetails == null ? null : sizeInfo == null ? null : sizeInfo, sb, id);
}
Aggregations