use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method onCommitRemoveBricks.
private void onCommitRemoveBricks() {
if (getConfirmWindow() == null) {
return;
}
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
GlusterVolumeEntity volumeEntity = getVolumeEntity();
ArrayList<GlusterBrickEntity> list = new ArrayList<>();
for (Object brickName : model.getItems()) {
GlusterBrickEntity brick = volumeEntity.getBrickWithQualifiedName((String) brickName);
if (brick != null) {
list.add(brick);
}
}
GlusterVolumeRemoveBricksParameters parameter = new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), list);
model.startProgress();
Frontend.getInstance().runAction(ActionType.CommitRemoveGlusterVolumeBricks, parameter, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
setConfirmWindow(null);
if (result.getReturnValue().getSucceeded()) {
disableRemoveBrickStatusPopUpActions();
}
}, model);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method preAddBricks.
private void preAddBricks(final GlusterVolumeEntity volumeEntity) {
if (volumeEntity == null) {
return;
}
final VolumeBrickModel volumeBrickModel = new VolumeBrickModel();
setWindow(volumeBrickModel);
if (volumeEntity.getVolumeType().isReplicatedType()) {
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> {
if (cluster.supportsGlusterService() && cluster.supportsVirtService()) {
// in HC mode, show a warning that add bricks is not recommended
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().hcAddBrickWarning());
model.setHelpTag(HelpTag.cannot_add_bricks);
// $NON-NLS-1$
model.setHashName("cannot_add_bricks");
// $NON-NLS-1$
UICommand yesCommand = new UICommand("AddBricks", VolumeBrickListModel.this);
yesCommand.setTitle(ConstantsManager.getInstance().getConstants().yes());
model.getCommands().add(yesCommand);
// $NON-NLS-1$
UICommand noCommand = new UICommand("CancelAll", VolumeBrickListModel.this);
noCommand.setTitle(ConstantsManager.getInstance().getConstants().no());
noCommand.setIsCancel(true);
noCommand.setIsDefault(true);
model.getCommands().add(noCommand);
return;
} else {
addBricks();
}
}), volumeEntity.getClusterId());
} else {
addBricks();
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method checkUpServerAndAddBricks.
private void checkUpServerAndAddBricks() {
if (getWindow() != null) {
return;
}
final GlusterVolumeEntity volumeEntity = getEntity();
cancelConfirmation();
if (volumeEntity == null) {
return;
}
AsyncDataProvider.getInstance().isAnyHostUpInCluster(new AsyncQuery<>(clusterHasUpHost -> {
if (clusterHasUpHost) {
preAddBricks(volumeEntity);
} else {
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().cannotAddBricksNoUpServerFound());
model.setHelpTag(HelpTag.cannot_add_bricks);
// $NON-NLS-1$
model.setHashName("cannot_add_bricks");
// $NON-NLS-1$
UICommand command = new UICommand("Cancel", VolumeBrickListModel.this);
command.setTitle(ConstantsManager.getInstance().getConstants().close());
command.setIsCancel(true);
model.getCommands().add(command);
return;
}
}), volumeEntity.getClusterName());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method onStopRemoveBricks.
private void onStopRemoveBricks() {
if (getConfirmWindow() == null) {
return;
}
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
GlusterVolumeEntity volumeEntity = getVolumeEntity();
ArrayList<GlusterBrickEntity> list = new ArrayList<>();
for (Object brickName : model.getItems()) {
GlusterBrickEntity brick = volumeEntity.getBrickWithQualifiedName((String) brickName);
if (brick != null) {
list.add(brick);
}
}
GlusterVolumeRemoveBricksParameters parameter = new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), list);
model.startProgress();
Frontend.getInstance().runAction(ActionType.StopRemoveGlusterVolumeBricks, parameter, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
setConfirmWindow(null);
if (result.getReturnValue().getSucceeded()) {
showRemoveBricksStatus();
}
}, model);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method stopRemoveBricks.
private void stopRemoveBricks() {
if (getConfirmWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().stopRemoveBricksMessage());
model.setHelpTag(HelpTag.volume_remove_bricks_stop);
// $NON-NLS-1$
model.setHashName("volume_remove_bricks_stop");
GlusterVolumeEntity volumeEntity = getVolumeEntity();
GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask();
ArrayList<String> list = new ArrayList<>();
for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
if (brick.getAsyncTask() != null && volumeTask != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volumeTask.getTaskId()) && volumeTask.getStatus() == JobExecutionStatus.STARTED) {
list.add(brick.getQualifiedName());
}
}
model.setItems(list);
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("OnStopRemoveBricks", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = new UICommand("CancelConfirmation", this);
cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close());
cancelCommand.setIsCancel(true);
model.getCommands().add(cancelCommand);
}
Aggregations