use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters in project ovirt-engine by oVirt.
the class VolumeParameterListModel method onSetParameter.
private void onSetParameter() {
if (getEntity() == null) {
return;
}
GlusterVolumeEntity volume = getEntity();
VolumeParameterModel model = (VolumeParameterModel) getWindow();
if (!model.validate()) {
return;
}
GlusterVolumeOptionEntity option = new GlusterVolumeOptionEntity();
option.setVolumeId(volume.getId());
option.setKey(model.getKeyList().getSelectedItem());
option.setValue(model.getValue().getEntity());
model.startProgress();
Frontend.getInstance().runAction(ActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(option), result -> {
VolumeParameterListModel localModel = (VolumeParameterListModel) result.getState();
localModel.postOnSetParameter(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters in project ovirt-engine by oVirt.
the class BackendGlusterVolumeResource method setOption.
@Override
public Response setOption(Action action) {
Option option = action.getOption();
validateParameters(option, "name", "value");
return doAction(ActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(new GlusterVolumeOptionEntity(guid, option.getName(), option.getValue())), action);
}
use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters in project ovirt-engine by oVirt.
the class CreateGlusterVolumeCommand method setVolumeOptions.
/**
* Sets all options of a volume by invoking the action {@link ActionType#SetGlusterVolumeOption} in a loop. <br>
* Errors if any are collected and added to "executeFailedMessages"
*/
private void setVolumeOptions(GlusterVolumeEntity volume) {
List<String> errors = new ArrayList<>();
for (GlusterVolumeOptionEntity option : volume.getOptions()) {
// make sure that volume id is set
option.setVolumeId(volume.getId());
ActionReturnValue setOptionReturnValue = runInternalAction(ActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(option), createCommandContext(volume, option));
if (!setOptionReturnValue.getSucceeded()) {
setSucceeded(false);
errors.addAll(setOptionReturnValue.getValidationMessages());
errors.addAll(setOptionReturnValue.getExecuteFailedMessages());
}
}
if (!errors.isEmpty()) {
handleVdsErrors(AuditLogType.GLUSTER_VOLUME_OPTION_SET_FAILED, errors);
}
}
Aggregations