use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity 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.GlusterBrickEntity 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.GlusterBrickEntity 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);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method onReplaceConfirmation.
private void onReplaceConfirmation() {
cancelConfirmation();
ReplaceBrickModel replaceBrickModel = (ReplaceBrickModel) getWindow();
GlusterVolumeEntity volumeEntity = getEntity();
GlusterBrickEntity existingBrick = getSelectedItem();
if (replaceBrickModel == null || volumeEntity == null || existingBrick == null) {
return;
}
if (!replaceBrickModel.validate()) {
return;
}
VDS server = replaceBrickModel.getServers().getSelectedItem();
if (server == null) {
return;
}
GlusterBrickEntity newBrick = new GlusterBrickEntity();
newBrick.setVolumeId(volumeEntity.getId());
newBrick.setServerId(server.getId());
newBrick.setServerName(server.getHostName());
newBrick.setBrickDirectory(replaceBrickModel.getBrickDirectory().getEntity());
replaceBrickModel.startProgress();
GlusterVolumeReplaceBrickActionParameters parameter = new GlusterVolumeReplaceBrickActionParameters(volumeEntity.getId(), existingBrick, newBrick);
Frontend.getInstance().runAction(ActionType.ReplaceGlusterVolumeBrick, parameter, result -> {
ReplaceBrickModel localModel = (ReplaceBrickModel) result.getState();
localModel.stopProgress();
setWindow(null);
}, replaceBrickModel);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class VolumeBrickListModel method commitRemoveBricks.
private void commitRemoveBricks() {
if (getConfirmWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().commitRemoveBricksMessage());
model.setHelpTag(HelpTag.volume_remove_bricks_commit);
// $NON-NLS-1$
model.setHashName("volume_remove_bricks_commit");
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.FINISHED) {
list.add(brick.getQualifiedName());
}
}
model.setItems(list);
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("OnCommitRemoveBricks", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this);
model.getCommands().add(cancelCommand);
}
Aggregations