use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity in project ovirt-engine by oVirt.
the class VolumeParameterListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
GlusterVolumeEntity glusterVolumeEntity = getEntity();
ArrayList<GlusterVolumeOptionEntity> list = new ArrayList<>();
for (GlusterVolumeOptionEntity glusterVolumeOption : glusterVolumeEntity.getOptions()) {
list.add(glusterVolumeOption);
}
setItems(list);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity in project ovirt-engine by oVirt.
the class VolumeParameterListModel method onResetParameter.
private void onResetParameter() {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (getSelectedItem() == null) {
return;
}
GlusterVolumeOptionEntity selectedOption = getSelectedItem();
ResetGlusterVolumeOptionsParameters parameters = new ResetGlusterVolumeOptionsParameters(selectedOption.getVolumeId(), selectedOption, false);
model.startProgress();
Frontend.getInstance().runAction(ActionType.ResetGlusterVolumeOptions, parameters, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity in project ovirt-engine by oVirt.
the class VolumeParameterListModel method editParameter.
private void editParameter() {
if (getWindow() != null) {
return;
}
GlusterVolumeEntity volume = getEntity();
if (volume == null) {
return;
}
VolumeParameterModel volumeParameterModel = new VolumeParameterModel();
volumeParameterModel.setTitle(ConstantsManager.getInstance().getConstants().editOptionVolume());
volumeParameterModel.setHelpTag(HelpTag.edit_option);
// $NON-NLS-1$
volumeParameterModel.setHashName("edit_option");
volumeParameterModel.setIsNew(false);
setWindow(volumeParameterModel);
volumeParameterModel.getKeyList().setIsChangeable(false);
volumeParameterModel.startProgress();
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
VolumeParameterModel innerParameterModel = (VolumeParameterModel) getWindow();
if (!returnValue.getSucceeded()) {
innerParameterModel.setOptionsMap(new HashMap<String, GlusterVolumeOptionInfo>());
innerParameterModel.setMessage(ConstantsManager.getInstance().getConstants().errorInFetchingVolumeOptionList());
} else {
innerParameterModel.setOptionsMap(getOptionsMap((Set<GlusterVolumeOptionInfo>) returnValue.getReturnValue()));
}
GlusterVolumeOptionEntity selectedOption = getSelectedItem();
// $NON-NLS-1$
innerParameterModel.getDescription().setEntity("");
innerParameterModel.getKeyList().setSelectedItem(selectedOption.getKey());
innerParameterModel.getValue().setEntity(selectedOption.getValue());
innerParameterModel.stopProgress();
// $NON-NLS-1$
UICommand command = UICommand.createDefaultOkUiCommand("OnSetParameter", VolumeParameterListModel.this);
innerParameterModel.getCommands().add(command);
// $NON-NLS-1$
command = UICommand.createCancelUiCommand("OnCancel", VolumeParameterListModel.this);
innerParameterModel.getCommands().add(command);
});
asyncQuery.setHandleFailure(true);
AsyncDataProvider.getInstance().getGlusterVolumeOptionInfoList(asyncQuery, volume.getClusterId());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity 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);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity in project ovirt-engine by oVirt.
the class GlusterSyncJob method saveNewOptions.
private void saveNewOptions(GlusterVolumeEntity volume, Collection<GlusterVolumeOptionEntity> entities) {
optionDao.saveAll(entities);
for (final GlusterVolumeOptionEntity entity : entities) {
Map<String, String> customValues = new HashMap<>();
customValues.put(GlusterConstants.OPTION_KEY, entity.getKey());
customValues.put(GlusterConstants.OPTION_VALUE, entity.getValue());
logUtil.logAuditMessage(volume.getClusterId(), volume.getClusterName(), volume, null, AuditLogType.GLUSTER_VOLUME_OPTION_SET_FROM_CLI, customValues);
log.info("New option '{}'='{}' set on volume '{}' from gluster CLI. Updating engine DB accordingly.", entity.getKey(), entity.getValue(), volume.getName());
}
}
Aggregations