use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterClusterSnapshotConfigureOptionsPopupView method initEditors.
private void initEditors() {
clusterEditor = new ListModelListBoxEditor<>(new NameRenderer<Cluster>());
configsTable = new EntityModelCellTable<>(false, true);
configsTable.setSelectionModel(new NoSelectionModel());
configsTable.addColumn(new AbstractEntityModelTextColumn<GlusterVolumeSnapshotConfig>() {
@Override
public String getText(GlusterVolumeSnapshotConfig object) {
return object.getParamName();
}
}, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
"200px");
Column<EntityModel<GlusterVolumeSnapshotConfig>, String> valueColumn = new Column<EntityModel<GlusterVolumeSnapshotConfig>, String>(new TextInputCell()) {
@Override
public String getValue(EntityModel<GlusterVolumeSnapshotConfig> object) {
return object.getEntity().getParamValue();
}
};
// $NON-NLS-1$
configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setParamValue(value));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterSnapshotSyncJob method addOrUpdateClusterConfig.
private void addOrUpdateClusterConfig(Cluster cluster, final String paramName, final String paramValue) {
GlusterVolumeSnapshotConfig param = new GlusterVolumeSnapshotConfig();
param.setClusterId(cluster.getId());
param.setVolumeId(null);
param.setParamName(paramName);
param.setParamValue(paramValue);
GlusterVolumeSnapshotConfig existingParamDetail = volumeSnapshotConfigDao.getConfigByClusterIdAndName(cluster.getId(), paramName);
if (existingParamDetail == null) {
volumeSnapshotConfigDao.save(param);
log.debug("Detected new gluster volume snapshot configuration '{}' with value '{}' for cluster: '{}'", paramName, paramValue, cluster.getName());
Map<String, String> customValues = new HashMap<>();
customValues.put("snapConfigName", paramName);
customValues.put("snapConfigValue", paramValue);
logUtil.logAuditMessage(cluster.getId(), cluster.getName(), null, null, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CLUSTER_CONFIG_DETECTED_NEW, customValues);
} else if (!existingParamDetail.getParamValue().equals(paramValue)) {
volumeSnapshotConfigDao.updateConfigByClusterIdAndName(cluster.getId(), paramName, paramValue);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig in project ovirt-engine by oVirt.
the class GlusterSnapshotSyncJob method addOrUpdateVolumeConfig.
private void addOrUpdateVolumeConfig(Cluster cluster, final GlusterVolumeEntity volume, final String paramName, final String paramValue) {
GlusterVolumeSnapshotConfig cfg = new GlusterVolumeSnapshotConfig();
cfg.setClusterId(cluster.getId());
cfg.setVolumeId(volume.getId());
cfg.setParamName(paramName);
cfg.setParamValue(paramValue);
GlusterVolumeSnapshotConfig existingParamDetail = volumeSnapshotConfigDao.getConfigByVolumeIdAndName(cluster.getId(), volume.getId(), paramName);
if (existingParamDetail == null) {
volumeSnapshotConfigDao.save(cfg);
log.debug("Detected new gluster volume snapshot configuration '{}' with value '{}' for volume: '{}' on cluster '{}'", paramName, paramValue, cluster.getName(), volume.getName());
Map<String, String> customValues = new HashMap<>();
customValues.put("snapConfigName", paramName);
customValues.put("snapConfigValue", paramValue);
customValues.put(GlusterConstants.VOLUME_NAME, volume.getName());
logUtil.logAuditMessage(cluster.getId(), cluster.getName(), volume, null, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_VOLUME_CONFIG_DETECTED_NEW, customValues);
} else if (!existingParamDetail.getParamValue().equals(paramValue)) {
volumeSnapshotConfigDao.updateConfigByVolumeIdAndName(cluster.getId(), volume.getId(), paramName, paramValue);
}
}
Aggregations