use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class VolumeListModel method onConfigureVolumeSnapshotOptions.
public void onConfigureVolumeSnapshotOptions() {
GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = (GlusterVolumeSnapshotConfigModel) getWindow();
GlusterVolumeEntity volumeEntity = volumeSnapshotConfigModel.getSelectedVolumeEntity();
List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<>();
for (EntityModel<VolumeSnapshotOptionModel> volumeCfg : volumeSnapshotConfigModel.getConfigOptions().getItems()) {
vdsParams.add(new GlusterVolumeSnapshotConfig(volumeEntity.getClusterId(), volumeEntity.getId(), volumeCfg.getEntity().getOptionName(), volumeCfg.getEntity().getOptionValue()));
}
Frontend.getInstance().runAction(ActionType.UpdateGlusterVolumeSnapshotConfig, new UpdateGlusterVolumeSnapshotConfigParameters(volumeEntity.getClusterId(), volumeEntity.getId(), vdsParams), result -> {
if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
cancel();
}
if (getConfirmWindow() != null) {
setConfirmWindow(null);
}
}, this);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class VolumeListModel method onConfigureClusterSnapshotOptions.
public void onConfigureClusterSnapshotOptions() {
GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = (GlusterClusterSnapshotConfigModel) getWindow();
Guid clusterId = clusterSnapshotConfigModel.getClusters().getSelectedItem().getId();
List<GlusterVolumeSnapshotConfig> vdsParams = new ArrayList<>();
for (EntityModel<GlusterVolumeSnapshotConfig> clusterCfg : clusterSnapshotConfigModel.getClusterConfigOptions().getItems()) {
vdsParams.add(new GlusterVolumeSnapshotConfig(clusterId, null, clusterCfg.getEntity().getParamName(), clusterCfg.getEntity().getParamValue()));
}
Frontend.getInstance().runAction(ActionType.UpdateGlusterVolumeSnapshotConfig, new UpdateGlusterVolumeSnapshotConfigParameters(clusterId, null, vdsParams), result -> {
if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
cancel();
}
if (getConfirmWindow() != null) {
setConfirmWindow(null);
}
}, this);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class VolumeListModel method confirmConfigureClusterSnapshotOptions.
public void confirmConfigureClusterSnapshotOptions() {
boolean cfgChanged = false;
GlusterClusterSnapshotConfigModel snapshotConfigModel = (GlusterClusterSnapshotConfigModel) getWindow();
if (!snapshotConfigModel.validate()) {
return;
}
for (EntityModel<GlusterVolumeSnapshotConfig> clusterCfg : snapshotConfigModel.getClusterConfigOptions().getItems()) {
if (!clusterCfg.getEntity().getParamValue().equals(snapshotConfigModel.getExistingClusterConfigValue(clusterCfg.getEntity().getParamName()))) {
cfgChanged = true;
break;
}
}
if (cfgChanged) {
ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().updateSnapshotConfigurationConfirmationTitle());
confirmModel.setHelpTag(HelpTag.configure_volume_snapshot_confirmation);
// $NON-NLS-1$
confirmModel.setHashName("configure_volume_snapshot_confirmation");
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youAreAboutChangeSnapshotConfigurationMsg());
// $NON-NLS-1$
UICommand tempVar = new UICommand("onConfigureClusterSnapshotOptions", this);
tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
tempVar.setIsDefault(true);
getConfirmWindow().getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = new UICommand("CancelConfirmation", this);
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
tempVar2.setIsCancel(true);
getConfirmWindow().getCommands().add(tempVar2);
} else {
onConfigureClusterSnapshotOptions();
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class SetGlusterVolumeSnapshotConfigVDSCommand method executeVdsBrokerCommand.
@Override
protected void executeVdsBrokerCommand() {
GlusterVolumeSnapshotConfig cfgParam = getParameters().getConfgParam();
String paramValue = StringUtils.removeEnd(cfgParam.getParamValue(), "%");
if (cfgParam.getVolumeId() != null) {
GlusterVolumeEntity volume = DbFacade.getInstance().getGlusterVolumeDao().getById(cfgParam.getVolumeId());
status = getBroker().glusterVolumeSnapshotConfigSet(volume.getName(), cfgParam.getParamName(), paramValue);
} else {
status = getBroker().glusterSnapshotConfigSet(cfgParam.getParamName(), paramValue);
}
proceedProxyReturnValue();
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterClusterSnapshotConfigModel method clusterSelectedItemChanged.
private void clusterSelectedItemChanged() {
Cluster selectedCluster = getClusters().getSelectedItem();
if (selectedCluster == null) {
return;
}
AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {
@Override
public void onSuccess(QueryReturnValue returnValue) {
Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = returnValue.getReturnValue();
if (configs != null) {
List<GlusterVolumeSnapshotConfig> clusterConfigOptions = configs.getFirst();
Collections.sort(clusterConfigOptions, Comparator.comparing(GlusterVolumeSnapshotConfig::getParamName));
setModelItems(getClusterConfigOptions(), clusterConfigOptions, existingClusterConfigs);
} else {
getClusterConfigOptions().setItems(null);
}
}
private void setModelItems(ListModel<EntityModel<GlusterVolumeSnapshotConfig>> listModel, List<GlusterVolumeSnapshotConfig> cfgs, Map<String, String> fetchedCfgsBackup) {
List<EntityModel<GlusterVolumeSnapshotConfig>> coll = new ArrayList<>();
for (GlusterVolumeSnapshotConfig cfg : cfgs) {
EntityModel<GlusterVolumeSnapshotConfig> cfgModel = new EntityModel<>();
cfgModel.setEntity(cfg);
fetchedCfgsBackup.put(cfg.getParamName(), cfg.getParamValue());
coll.add(cfgModel);
}
// set the entity items
listModel.setItems(coll);
}
}), selectedCluster.getId(), null);
}
Aggregations