use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class VolumeListModel method showRebalanceStatus.
private void showRebalanceStatus() {
if (getSelectedItem() == null) {
return;
}
final ConfirmationModel cModel = new ConfirmationModel();
final GlusterVolumeEntity volumeEntity = getSelectedItem();
setConfirmWindow(cModel);
cModel.setTitle(ConstantsManager.getInstance().getConstants().rebalanceStatusTitle());
// $NON-NLS-1$
cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
cModel.setHelpTag(HelpTag.volume_rebalance_status);
// $NON-NLS-1$
cModel.setHashName("volume_rebalance_status");
// $NON-NLS-1$
final UICommand rebalanceStatusOk = new UICommand("closeConfirmationWindow", VolumeListModel.this);
rebalanceStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
rebalanceStatusOk.setIsCancel(true);
cModel.getCommands().add(rebalanceStatusOk);
AsyncDataProvider.getInstance().getGlusterRebalanceStatus(new AsyncQuery<>(returnValue -> {
cModel.stopProgress();
GlusterVolumeTaskStatusEntity rebalanceStatusEntity = returnValue.getReturnValue();
if ((rebalanceStatusEntity == null) || !returnValue.getSucceeded()) {
cModel.setMessage(ConstantsManager.getInstance().getMessages().rebalanceStatusFailed(volumeEntity.getName()));
} else {
setConfirmWindow(null);
if (getWindow() == null) {
VolumeRebalanceStatusModel rebalanceStatusModel = new VolumeRebalanceStatusModel(volumeEntity);
rebalanceStatusModel.setTitle(ConstantsManager.getInstance().getConstants().volumeRebalanceStatusTitle());
setWindow(rebalanceStatusModel);
rebalanceStatusModel.setHelpTag(HelpTag.volume_rebalance_status);
// $NON-NLS-1$
rebalanceStatusModel.setHashName("volume_rebalance_status");
rebalanceStatusModel.getVolume().setEntity(volumeEntity.getName());
rebalanceStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
// $NON-NLS-1$
UICommand stopRebalanceFromStatus = new UICommand("stop_rebalance_from_status", VolumeListModel.this);
stopRebalanceFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRebalance());
rebalanceStatusModel.getCommands().add(stopRebalanceFromStatus);
rebalanceStatusModel.setStopReblanceFromStatus(stopRebalanceFromStatus);
// $NON-NLS-1$
UICommand cancelRebalance = new UICommand("CancelRebalanceStatus", VolumeListModel.this);
cancelRebalance.setTitle(ConstantsManager.getInstance().getConstants().close());
cancelRebalance.setIsCancel(true);
rebalanceStatusModel.getCommands().add(cancelRebalance);
rebalanceStatusModel.showStatus(rebalanceStatusEntity);
} else {
VolumeRebalanceStatusModel statusModel = (VolumeRebalanceStatusModel) getWindow();
statusModel.getCommands().get(0).setIsExecutionAllowed(false);
statusModel.showStatus(rebalanceStatusEntity);
}
}
}), volumeEntity.getClusterId(), volumeEntity.getId());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class GetGlusterVolumeRemoveBricksStatusVDSCommand method executeVdsBrokerCommand.
@Override
protected void executeVdsBrokerCommand() {
String volumeName = getParameters().getVolumeName();
List<GlusterBrickEntity> bricksList = getParameters().getBricks();
String[] brickNames = new String[bricksList.size()];
for (int count = 0; count < bricksList.size(); count++) {
brickNames[count] = bricksList.get(count).getQualifiedName();
}
result = getBroker().glusterVolumeRemoveBrickStatus(volumeName, brickNames);
proceedProxyReturnValue();
// Set the current engine time as status time
GlusterVolumeTaskStatusEntity entity = result.getStatusDetails();
entity.setStatusTime(new Date());
setReturnValue(entity);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class GetGlusterVolumeRebalanceStatusVDSCommand method executeVdsBrokerCommand.
@Override
protected void executeVdsBrokerCommand() {
String volumeName = getParameters().getVolumeName();
result = getBroker().glusterVolumeRebalanceStatus(volumeName);
proceedProxyReturnValue();
// Set the current engine time as status time
GlusterVolumeTaskStatusEntity entity = result.getStatusDetails();
entity.setStatusTime(new Date());
setReturnValue(entity);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method showRemoveBricksStatus.
private void showRemoveBricksStatus() {
final GlusterVolumeEntity volumeEntity = getVolumeEntity();
final ArrayList<GlusterBrickEntity> bricks = new ArrayList<>();
for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null) {
bricks.add(brick);
}
}
final ConfirmationModel cModel = new ConfirmationModel();
cModel.setHelpTag(HelpTag.volume_remove_bricks_status);
// //$NON-NLS-1$
cModel.setHashName("volume_remove_bricks_status");
// $NON-NLS-1$
UICommand removeBrickStatusOk = new UICommand("CancelConfirmation", VolumeBrickListModel.this);
removeBrickStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
removeBrickStatusOk.setIsCancel(true);
cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
cModel.getCommands().add(removeBrickStatusOk);
cModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
setConfirmWindow(cModel);
// $NON-NLS-1$
final UICommand stopRemoveBrickFromStatus = new UICommand("StopRemoveBricksOnStatus", this);
stopRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksButton());
stopRemoveBrickFromStatus.setIsExecutionAllowed(false);
// $NON-NLS-1$
final UICommand commitRemoveBrickFromStatus = new UICommand("CommitRemoveBricksOnStatus", this);
commitRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksButton());
commitRemoveBrickFromStatus.setIsExecutionAllowed(false);
// $NON-NLS-1$
final UICommand retainBricksFromStatus = new UICommand("RetainBricksOnStatus", this);
retainBricksFromStatus.setTitle(ConstantsManager.getInstance().getConstants().retainBricksButton());
retainBricksFromStatus.setIsExecutionAllowed(false);
// $NON-NLS-1$
final UICommand cancelCommand = new UICommand("CancelRemoveBricksStatus", this);
cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close());
cancelCommand.setIsCancel(true);
AsyncDataProvider.getInstance().getGlusterRemoveBricksStatus(new AsyncQuery<>(returnValue -> {
cModel.stopProgress();
if (returnValue.getSucceeded() && returnValue.getReturnValue() != null) {
cancelConfirmation();
RemoveBrickStatusModel removeBrickStatusModel;
GlusterVolumeTaskStatusEntity removeBrickStatusEntity = returnValue.getReturnValue();
if (getWindow() == null) {
removeBrickStatusModel = new RemoveBrickStatusModel(volumeEntity, bricks);
removeBrickStatusModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
removeBrickStatusModel.setHelpTag(HelpTag.volume_remove_bricks_status);
// //$NON-NLS-1$
removeBrickStatusModel.setHashName("volume_remove_bricks_status");
setWindow(removeBrickStatusModel);
removeBrickStatusModel.getVolume().setEntity(volumeEntity.getName());
removeBrickStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
removeBrickStatusModel.addStopRemoveBricksCommand(stopRemoveBrickFromStatus);
removeBrickStatusModel.addCommitRemoveBricksCommand(commitRemoveBrickFromStatus);
removeBrickStatusModel.addRetainBricksCommand(retainBricksFromStatus);
removeBrickStatusModel.getCommands().add(cancelCommand);
} else {
removeBrickStatusModel = (RemoveBrickStatusModel) getWindow();
}
removeBrickStatusModel.showStatus(removeBrickStatusEntity);
} else {
cModel.setMessage(ConstantsManager.getInstance().getMessages().removeBrickStatusFailed(volumeEntity.getName()));
}
}), volumeEntity.getClusterId(), volumeEntity.getId(), bricks);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity in project ovirt-engine by oVirt.
the class GlusterTaskStatisticalQueryTest method getTaskEntity.
private GlusterVolumeTaskStatusEntity getTaskEntity() {
GlusterVolumeTaskStatusEntity entity = new GlusterVolumeTaskStatusEntity();
List<GlusterVolumeTaskStatusForHost> hostStatusList = new ArrayList<>();
hostStatusList.add(getTaskStatusForHost(0));
hostStatusList.add(getTaskStatusForHost(1));
entity.setHostwiseStatusDetails(hostStatusList);
return entity;
}
Aggregations