use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method remove.
@Override
public Response remove(Action action) {
GlusterBricks bricks = action.getBricks();
if (bricks.getGlusterBricks().size() > 0) {
for (GlusterBrick brick : bricks.getGlusterBricks()) {
validateParameters(brick, "id|name");
}
}
int replicaCount = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, REPLICA_COUNT, 0, 0);
GlusterVolumeRemoveBricksParameters params = toParameters(bricks);
params.setReplicaCount(replicaCount);
GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), "");
if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) {
return performAction(ActionType.CommitRemoveGlusterVolumeBricks, params);
} else {
return performAction(ActionType.GlusterVolumeRemoveBricks, params);
}
}
use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method migrate.
@Override
public Response migrate(Action action) {
validateParameters(action, "bricks");
validateBrickNames(action);
GlusterVolumeRemoveBricksParameters params = toParameters(action.getBricks());
return performAction(ActionType.StartRemoveGlusterVolumeBricks, params, action, false);
}
use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method stopMigrate.
@Override
public Response stopMigrate(Action action) {
validateParameters(action, "bricks");
validateBrickNames(action);
GlusterVolumeRemoveBricksParameters params = toParameters(action.getBricks());
return performAction(ActionType.StopRemoveGlusterVolumeBricks, params, action, false);
}
use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters in project ovirt-engine by oVirt.
the class VolumeBrickListModel method onRemoveBricks.
private void onRemoveBricks() {
if (getWindow() == null) {
return;
}
RemoveBrickModel model = (RemoveBrickModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (getSelectedItems() == null || getSelectedItems().isEmpty()) {
return;
}
GlusterVolumeEntity volumeEntity = getEntity();
GlusterVolumeRemoveBricksParameters parameter = new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), getSelectedItems());
if (volumeEntity.getVolumeType() == GlusterVolumeType.REPLICATE) {
parameter.setReplicaCount(volumeEntity.getReplicaCount() - 1);
} else if (volumeEntity.getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) {
if (model.isReduceReplica()) {
parameter.setReplicaCount(volumeEntity.getReplicaCount() - 1);
} else {
parameter.setReplicaCount(volumeEntity.getReplicaCount());
}
}
model.startProgress();
boolean isMigrate = model.getMigrateData().getEntity();
Frontend.getInstance().runAction(isMigrate ? ActionType.StartRemoveGlusterVolumeBricks : ActionType.GlusterVolumeRemoveBricks, parameter, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
setWindow(null);
}, model);
}
use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters 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);
}
Aggregations